Copy CodeThe code is as follows:
Capture Home Address
$url = "http://emotion.pclady.com.cn/skills/";
Get page code
$rs =file_get_contents ($url);
Set matching Regular
$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 around you*/
$preg = '/ ]+\ "> (. *) <\/a><\/i>/i ';
Perform a regular search
Preg_match_all ($preg, $rs, $title);
Calculate the number of headings
$count =count ($title [0]);
echo $count. "
";
Content acquisition through the number of headings
for ($i =0; $i < $count; $i + +) {
Set the content page address
$PR = '/]+\ ' >/isu ';
Preg_match_all ($PR, $title [0][$i], $jurl);
$substr =substr ($jurl [0][0],9);
$curl =substr ($substr, 0,-18);
Get the content page code
$c =file_get_contents ($curl);
Set content page Match regular
$pc = '/]+\ ' >/i ';
Perform a regular match 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 + +) {
}
}
?>
Through detection, $c is already the data stream of the content page, but why does the regular expression of $pc match only <这个字符其他的都没有呢,是因为我上面用了subsrt()函数吗?还是什么问题?麻烦各位大侠指点迷津啊?
This character is not the rest of it, because I used the SUBSRT () function? What's the problem? The "
Above introduces the program PHP information collection program code, including the program content, I hope that the PHP tutorial interested friends have helped.