php信息采集开发,程序php信息采集程序代码
//采集首頁地址
$url="http://emotion.pclady.com.cn/skills/";
//獲取頁面代碼
$rs=file_get_contents($url);
//設(shè)置匹配正則
//$fp=fopen("text.txt","a");
//$fw=fwrite($fp,$rs);
//fclose($fp);
/*href="http://emotion.pclady.com.cn/skills/0903/376476.html"
target=_blank>留住你身邊的好男人*/
$preg='/]+\">(.*)/i';
//進(jìn)行正則搜索
preg_match_all($preg,$rs,$title);
//計算標(biāo)題數(shù)量
$count=count($title[0]);
echo $count."
";
//通過標(biāo)題數(shù)量進(jìn)行內(nèi)容采集
for ($i=0;$i//設(shè)置內(nèi)容頁地址
$pr='/]+\">/isU';
preg_match_all($pr,$title[0][$i],$jurl);
$substr=substr($jurl[0][0],9);
$curl=substr($substr,0,-18);
//獲取內(nèi)容頁代碼
$c=file_get_contents($curl);
//設(shè)置內(nèi)容頁匹配正則
$pc='/]+\">/i';
//進(jìn)行正則匹配搜索
preg_match($pc,$c,$content);
//輸出標(biāo)題
echo $title[0][$i]."
";
echo $title[1][$i]."
";
$c
echo $concount."
";
echo $content[0][0];
for ($j=0;$j}
}
?>
總結(jié)
以上是生活随笔為你收集整理的php信息采集开发,程序php信息采集程序代码的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c++ new 数组_用Java实现JV
- 下一篇: mysql数据库删除列数据_MySQL数