标题: 柯林文章采集php程序
时间: 2013-05-08
<?php
header("content-type:text/html;charset=utf-8");
?>
<title>柯林文章采集程序</title></head><body><form action="work.php" method="POST">采集的域名:<input name="url" value="http://"/><br/>文章版块id:<input name="classid" value=""/><br/>文章id采集范围:<br/>起:<input name="id" value="" size="1"/><br/>末:<input name="iid" value="" size="1"/><br/><input type="submit" value=">>>采集>>>"/></form>
</body>
</html>
<?php
header("content-type:text/html;charset=utf-8");
?>
<title>采集状态</title></head><body>
<?
$url=$_POST['url'];
$c=$_POST['classid'];
$id=$_POST['id'];
$iid=$_POST['iid'];
while($id<=$iid)
{
$content=file_get_contents("$url/article/book_view.aspx?siteid=1000&classid=$c&id=$id&lpage=1&sid=-2-0-0-0-0");
$pa='%<div class="title">(.*?)<\/div>(.*?)<div class="content"><p align="center"></p>(.*?)<\/div>%si';
preg_match($pa,$content,$r);
$txt=str_replace
("<br/>","///","$r[3]");
$bt=str_replace(" ",'',$r[1]);
$StatDir=dirname(__FILE__);
$text=$txt;
$file=$bt;
$fp=fopen($StatDir."/phpjc/".$file,"a ");
$stat=$text."\n".$bz;
fputs($fp,$stat);
fclose($fp);
echo "$bt<br/>>>>采集成功<br/>";
$id ;
}
?></HTML>
『回复列表(11|隐藏机器人聊天)』