[源码.更新1]虎绿林帖子收集源码

@Ta 2014-09-26 5742点击
以下为更新版:(可直接在线访问 而不用查看hu.txt)
 hu.zip
这是源码以及我已经采集的帖子 

注:此采集非彼采集,该源码只是收集首页帖子的名字(因为我周末在线,不想错过某些'资源贴,而又懒得一页一页翻) 
 <?php

header("content-Type: text/html; charset=utf-8");
 
$do=$_GET['do'];
#print_r($r);
$txt=@file_get_contents('hu.txt'); 
echo "<a href=?do=send>采集</a>|<a href=?do=look>查看</a><hr>";
if($do=='send'){
for($i=0;$i<8;$i++){
echo $f=file_get_contents('http://hu60.cn/wap/');
preg_match_all('!tzid=(\d+)&amp;bkid=(\d+)">(.*?)</a>!i',$f,$r); 
$bkid=$r[2][$i];
$tzid=$r[1][$i];
$name=$r[3][$i];
if(strpos($txt,$name)===false){
$url="http://allnew.hu60.cn/wap/read.php?id=bbs_tz&tzid={$tzid}&bkid={$bkid}";
file_put_contents('hu.txt',$name."|$url"."\n",FILE_APPEND);}

}}
if($do=='look'){
$m=explode("\n",$txt);
foreach($m as $t){
$ui=explode('|',$t);
$name=$ui[0];
$url=$ui[1];
echo "<a href=$url>$name</a>
";
}

}

?>
以下为旧版:
<?php
echo $f=file_get_contents('http://hu60.cn/wap/');
preg_match_all('!bkid=(\d+)">(.*?)</a>!i',$f,$r);
#print_r($r);
foreach($r[2] as $o){
$txt=@file_get_contents('hu.txt');
if(strpos($txt,$o)===false){

file_put_contents('hu.txt',"$o"."\n",FILE_APPEND);}

}

注:此采集非彼采集,该源码只是收集首页帖子的名字(因为我周末在线,不想错过某些'资源贴,而又懒得一页一页翻)
回复列表(12|隐藏机器人聊天)
添加新回复
回复需要登录