----------*/
/*登录论坛 begin*/
$url = ''http://bbs.war3.cn/logging.php?action=login'';
$postfields=''loginfield=username&username=1nject10n&password=xxxxxx&questionid=0&cookietime=315360000&referer=http://bbs.war3.cn/&loginsubmit=提交'';
request($url,$postfields,$cookie_jar,'''');
unset($postfields,$url);
/*登录论坛 end*/
/*获取帖子列表(位于第一页的帖子) begin*/
$url = ''http://bbs.war3.cn/forumdisplay.php?fid=57'';
$code = request($url,'''',$cookie_jar,'''');
$threadsList = getThreadsList($code);
/*获取帖子列表 end*/
//帖子序列
$rows = 0;
/*循环抓取所有帖子源代码 begin*/
foreach($threadsList as $list){
$url = "http://bbs.war3.cn/viewthread.php?tid=$list";
if(isExits($code)){
$code = request($url,'''',$cookie_jar,'''');
$color = $rows%2==0?''#00CCFF'':''#FFFF33'';
echo " <div style=''background-color:$color''>";
echo " <h1>第",($rows+1),"贴: </h1> <br/>";
$author = getAuthor($code);
printAuthor($author);
$title = getTitle($code);
printTitle($title);
$contents = getContents($code);
printContents($contents);
echo " </div>";
$rows++;
}
else
printError();
echo "----------------------------------------------------------------------------------------- <br/> <br/>";
}
/*抓取源代码 end*/
?>
|