作者:张骞2502860155 | 来源:互联网 | 2018-07-17 07:23
ec(2);自家用的 php采集程序呵呆把它拿出来吧 php采集代码,php采集器 ,必一下就可能变成php论坛采集程序,自动采集程序phpphp采集原理是读取远程文章的内容然后正我们想要用东西,<?php set_time_limit(0);设置文档永不过期 $url &nb
自家用的 php 采集程序呵呆把它拿出来吧 php采集代码,php 采集器 ,必一下就可能变成php论坛采集程序,自动采集程序 php php采集原理是读取远程文章的内容然后正我们想要用东西,
set_time_limit(0); //设置文档永不过期
$url =$_POST["url"];//URL
$start =$_POST["start"];//开始
$end =$_POST["end"];//结束
//$encode_start =$_POST["encode_start"]; //取得内容代码开始
$encode_end =$_POST["encode_end"];//取得内容结束
$type =$_POST["select"];//主类
$ztype =$_POST["select2"];//子类
$admin =$_POST["admin"];//用户
$r_type =$_POST['type'];
$c_total =0;
for($i=$start;$i<=$end;$i++){
$getreal=$url.$i.".html";
echo $getreal;
echo " ";
@sava_data(new_content(getcontent($getreal),$r_type,$encode_end),$type,$admin,$ztype);
$c_total++;
}
echo "共采集".($c_total)."篇文章";
echo "Back ";
//print_r( new_content(getcontent('http://www.diybl.com/course/4_webprogram/php/phpshil/2007828/69928.html'),'aa','aa'));
//echo 'x iloveyou
ffdafdafds';
function getcontent($url)
{
$retmsg=file_get_contents($url);
return $retmsg;
}
function new_content($retmsg,$replace,$class){
$r_type="-ddd";
$start ="
";
$end ="sss落 ";
$arr1 =explode($start,$retmsg);
$arr2 =explode($end,$arr1[1]);
$ts =preg_replace("/]*>/","",$arr2[0]);/* 清除连接 ]*>*/
$ts =preg_replace("/ ]*>/im","",$arr2[0]);/* 清除连接*/
$ts =@str_replace("(sss",'',$ts);
preg_match('/(.+?)<\/TITLE>/', $retmsg, $arr);/* 取得标题*/
$p =@str_replace("$replace",'',$arr[1]);
$ts =substr($ts,0,strlen($ts)-70);
return $value =array($p,$ts);
}
function sava_data($lvalue,$type,$admin,$ztype){
$tsql ="select * from filecontent where title='".addslashes($lvalue[0])."'";
$result =mysql_query($tsql) or die(mysql_error());
if(!mysql_num_rows($result)){
$title_ =strip_tags($lvalue[0]);
$content_ =addslashes($lvalue[1]);
@mysql_query("Insert into filecontent(title,content,filesendid,filesendtime,siteindex,systype,z_type) value('$title_','$content_','$admin','".date("Y-m-d")."','1','$type',$ztype)") ;
}}
原创:www.111cn.net