php 采集器
本款文章是一款用php实现的文章采集功能哦,只是一个简单的功能不过源码也就很少了,适合于小型的采集功能哦。
本款文章是一款用php实现的文章采集功能哦,只是一个简单的功能不过源码也就很少了,适合于小型的采集功能哦。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
set_time_limit(0);
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<?php
$filecontent = getcontent(http://111cn.cn);
$start = s;
$end =b;
$art = 311;
$str = ;
preg_match(/<title>(.+?)</title>/, $filecontent, $arr);/* 取得标题*/
$init =explode($start,$filecontent);
$array = explode($end,$init[1]);
$str =$str.$arr[1].replaceHtml($array[0]);
function getcontent($url)
{
$retmsg=file_get_contents($url);
return $retmsg;
}
function savato($filename,$content){
if( !empty( $content ) ){
$info = fopen($filename,w+);
fwrite($info,$content);
fclose($info);
echo "保存文件 $filename 成功<br>";
}else{
echo 文章更新失败,<a href=get.php >点击重新更新</a>;
}
}
function replaceHtml($str){
$temp = str_replace( , ,$str);
$temp = str_replace(<BR>,chr(10),$temp);
$ return strip_tags($temp);
}
?>
</body>
</html>
文章网址:http://www.phprm.com/frame/php1004928.html
随意转载^^但请附上教程地址。