<? //----------------------------------- // 版权所有:zairwolf/书生 //----------------------------------- set_time_limit(0); $uname = '你的帐号';$pwd = '你的密码';$site="http://www.im286.com";login();$formhash=gethash(); while(1){ parse(45); // parse(27); // if($i++>10) break; } echo "全部刷完"; function parse($fid){//刷当前版第一页 global $site,$formhash,$uname; echo "------------开刷--------$fid------------ "; $fd=file_get_contents("$site/forumdisplay.php?fid=$fid&page="); $tagarr=array("论坛主题","<table width="); $startpos = strpos($fd,$tagarr[0])+strlen($tagarr[0]);$endpos = strpos($fd,$tagarr[1],$startpos);//截取标记 $fd=substr($fd,$startpos,$endpos-$startpos); preg_match_all("/"viewthread.php?tid=([d]*)&.*<td class="altbg2" align="center">([d]*)</td>.*viewpro.*>(.*)</a>/sU",$fd,$fd);//print_r($fd);exit; unset($fd[0]); foreach($fd[1] as $key=>$val){ if($fd[3][$key]<>$uname) { curladd($val,$fd[3][$key]); echo "-------------".$fd[2][$key]."--贴----最后回复--".$fd[3][$key]."----------$val------- "; sleep(15); }else { } } } function curladd($threadid,$author){//写入 global $site,$formhash; $add=time()%7==0?" {$author} 的帖子一定要顶":''; $message=getanswer(getlastpost($threadid)).$add; $b="action=reply&tid=$threadid&replysubmit=yes&formhash=$formhash&subject=&usesig=1&message=".urlencode($message); $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_URL, "$site/post.php"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $b); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/99.99 (compatible; MSIE 99.99; Windows XP 99.99)"); curl_exec($ch); curl_close ($ch); } function getlastpost($tid){//得到最后回复 global $site; $url="$site/redirect.php?tid=$tid&goto=lastpost"; $fd=file_get_contents($url); preg_match_all("/<span style="font-size: 12px">(.*)</span>/isU",$fd,$fd); Return end($fd[1]); } function getanswer($con){//得到答案 $url= "http://www.xiaoi.com/engine.isp?font=0&bold=0&italic=0&underline=0&fontColor=black&messageText=".urlencode($con)."&botid=popup-bot"; $fd=file_get_contents($url); $startpos = strpos($fd,'</textarea>')+strlen('</textarea>');$endpos = strpos($fd,'</textarea>',$startpos);//截取标记 $fd=trim(str_replace('<textarea id="answer">','',substr($fd,$startpos,$endpos-$startpos))); $fdrep=array( "xiaoi.com"=>"read8.net", "xiaoi"=>"read8", "小I"=>"读吧.net", "小i"=>"读吧.net", ); foreach($fdrep as $key=>$val){ $fd=str_replace($key,$val,$fd); } Return $fd; } function login(){//登陆 global $uname,$pwd,$formhash,$site; $strLoginData = "formhash=$formhash&loginfield=username&username=$uname&password=$pwd&loginsubmit=%CC%E1+%26%23160%3B+%BD%BB"; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_URL, "$site/logging.php?action=login"); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/99.99 (compatible; MSIE 99.99; Windows XP 99.99)"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $strLoginData); curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_exec($ch); curl_close ($ch); } function gethash(){ $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_URL, "$site/post.php"); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/99.99 (compatible; MSIE 99.99; Windows XP 99.99)"); curl_setopt($ch, CURLOPT_POSTFIELDS, "action=newthread&fid=45&extra=page%3D1"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); $fd=curl_exec($ch); curl_close ($ch); $tagarr=array('formhash" value="','"'); $startpos = strpos($fd,$tagarr[0])+strlen($tagarr[0]);$endpos = strpos($fd,$tagarr[1],$startpos);//截取标记 Return substr($fd,$startpos,$endpos-$startpos);
function reply ($threadid='',$message='',$fid=1) { $typeid = 1; $formhash = "6b498605"; $server = 'www.im286.com'; // IP address $host = 'www.im286.com'; // Domain name $port = 80; $referer = 'http://www.im286.com/'; // Referer $cookie = 'cdb_sid=;//你的sid,可以用flashget取得,直接取得sid程序不公开 $url = "/post.php?action=reply&fid=$fid&tid=$threadid&replysubmit=yes"; $socket = fsockopen($server, $port, $errno, $errstr, 30); if($socket) { $posts = array ('formhash' => $formhash,'subject' => $subject,'message' => $message); foreach( $posts AS $name => $value ) { $postValues = $postValues . urlencode( $name ) . "=" . urlencode( $value ) . '&'; } $postValues = substr( $postValues, 0, -1 ); $lenght = strlen( $postValues ); $request = "POST $url HTTP/1.1\r\n"; $request .= "Host: $host\r\n"; $request .= "User-Agent: " . $_SERVER['HTTP_USER_AGENT'] . "\r\n"; $request .= "Accept: */*\r\n"; $request .= "Accept-Language: " . $_SERVER['HTTP_ACCEPT_LANGUAGE'] . "\r\n"; $request .= "Referer: $referer\r\n"; $request .= "Cookie: $cookie\r\n"; $request .= "Keep-Alive: 300\r\n"; $request .= "Connection: keep-alive\r\n"; $request .= "Cache-Control: max-age=0\r\n"; $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; $request .= "Pragma: no-cache\r\n"; $request .= "Cache-Control: no-cache\r\n"; $request .= "Content-Length: $lenght\r\n"; $request .= "\r\n"; $request .= $postValues; fputs( $socket, $request ); fclose( $socket ); } }
function getlastpost($tid){//得到最后回复 global $site; $url="$site/redirect.php?tid=$tid&goto=lastpost"; $fd=file_get_contents($url); preg_match_all("/<span style="font-size: 12px">(.*)</span>/isU",$fd,$fd); Return end($fd[1]); } function getanswer($con){//得到答案 $url= "http://www.xiaoi.com/engine.isp?font=0&bold=0&italic=0&underline=0&fontColor=black&messageText=".urlencode($con)."&botid=popup-bot"; $fd=file_get_contents($url); $startpos = strpos($fd,'</textarea>')+strlen('</textarea>');$endpos = strpos($fd,'</textarea>',$startpos);//截取标记 $fd=trim(str_replace('<textarea id="answer">','',substr($fd,$startpos,$endpos-$startpos))); $fdrep=array( "xiaoi.com"=>"read8.net", "xiaoi"=>"read8", "小I"=>"读吧.net", "小i"=>"读吧.net", );