//采集首頁(yè)地址
$url="http://emotion.pclady.com.cn/skills/";
//獲取頁(yè)面代碼
$rs=file_get_contents($url);
//設(shè)置匹配正則
//$fp=fopen("text.txt","a");
//$fw=fwrite($fp,$rs);
//fclose($fp);
/*<I class=titles><A
;
//進(jìn)行正則搜索
preg_match_all($preg,$rs,$title);
//計(jì)算標(biāo)題數(shù)量
$count=count($title[0]);
echo $count."<br>";
//通過標(biāo)題數(shù)量進(jìn)行內(nèi)容采集
for ($i=0;$i<$count;$i++){
//設(shè)置內(nèi)容頁(yè)地址
$pr='/<a\s+href=\"[^>]+\">/isU';
preg_match_all($pr,$title[0][$i],$jurl);
$substr=substr($jurl[0][0],9);
$curl=substr($substr,0,-18);
//獲取內(nèi)容頁(yè)代碼
$c=file_get_contents($curl);
//設(shè)置內(nèi)容頁(yè)匹配正則
$pc='/<a\s+href=\"[^>]+\">/i';
//進(jìn)行正則匹配搜索
preg_match($pc,$c,$content);
//輸出標(biāo)題
echo $title[0][$i]."<br>";
echo $title[1][$i]."<br>";
$concount=count($content[0]);
echo $concount."<br>";
echo $content[0][0];
for ($j=0;$j<$concount;$j++){
}
}