<?php
@set_time_limit(0);
$p=@file_get_contents("p.txt");
if($p==0 or $p==''){$p=1;}
$pa=file_get_contents("http://m.kxin.cc/new.asp?page=$p");
preg_match_all('/view\.asp\?id=(\d+)\">(.*)<\/a>/',$pa,$re);
//print_r($re);
for($i=0;$i<20;$i++){
$id=$re[1][$i];
$name=$re[2][$i];
$u="http://m.kxin.cc/view.asp?id={$id}";
$f=file_get_contents($u);
$tt=explode('<br/><br/>',$f);
$tt=explode('送',$tt[1]);
//print_r($tt);
$nr=str_replace(array("<br/>"),array(""),$tt[0]);
$nr=strip_tags($nr);
$t=$nr;
//echo $nr;
$nr="#{$name}#"."[{$nr}]"."@"."\n";
$ff=fopen("joke.txt","a+");
$fi=file_get_contents("joke.txt");
if(!strstr($fi,$t) and $t and !strstr($t,'免费下载图片')){
fwrite($ff,$nr);}
fclose($ff);
}
$pi=$p+1;
file_put_contents("p.txt",$pi);
我采集了7m,也许有错误。。自己修改吧!
不过,大哥匹配内容我没用正则。。。
用的是explpde