最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php文章采集
时间:2008-05-20 编辑:简简单单 来源:一聚教程网
自家用的 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('/
$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)") ;
}}
相关文章
- PHP导出数据超时的优化建议解读 10-31
- PHP之mysql位运算解析 10-31
- Laravel实现登录跳转功能解析 10-31
- php双向队列解读 10-31
- Laravel异常上下文解决教程 10-24
- php数组查询元素位置方法介绍 10-24