Copy the code The code is as follows:
//Collect the homepage address
$url="http://emotion.pclady.com.cn/skills/";
//Get the page code
$rs=file_get_contents($url);
//Set matching regularity
//$fp=fopen("text.txt","a");
//$fw=fwrite($fp,$rs);
//fclose($fp);
/*href="http://emotion.pclady.com.cn/skills/0903/376476.html"
target=_blank> Keep the good man by your side*/
$preg='/
//Perform regular search
preg_match_all($preg,$rs,$title);
//Calculate the number of titles
$count=count ($title[0]);
echo $count."
";
//Collect content by the number of titles
for ($i=0;$i<$count;$i++){
// Set the content page address
$pr='/
preg_match_all($pr,$title[0][$i],$jurl);
$substr=substr($jurl[0][0],9);
$curl=substr($substr,0,-18);
//Get content page code
$c=file_get_contents($curl);
//Set content page matching regular rules
$pc='/
//Perform regular matching search
preg_match($pc,$c, $content);
//Output title
echo $title[0][$i]."
";
echo $title[1][$i]."
";
$c
echo $concount."
";
echo $content[0][0];
for ($j=0;$j<$concount;$j++){
}
}
?>
The above introduces the program PHP information collection program code, including program content. I hope it will be helpful to friends who are interested in PHP tutorials.