Php information collection program code. Copy the code as follows :? Collection homepage address $ urlemotion.pclady.com. cnskills; get page code $ rsfile_get_contents ($ url); set matching regular expression $ fpfopen (t
The code is as follows:
// Collection homepage address
$ Url = "http://emotion.pclady.com.cn/skills ";
// Obtain the page code
$ Rs = file_get_contents ($ url );
// Set the matching regular expression
// $ Fp = fopen ("text.txt", "");
// $ Fw = fwrite ($ fp, $ rs );
// Fclose ($ fp );
/*Href = "http://emotion.pclady.com.cn/skills/0903/376476.html"
Target = _ blank> keep the good guys around you*/
$ Preg = '/ ] + \ "> (. *) <\/A> <\/I>/I ';
// 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 = '/] + \ ">/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 the content page to match the regular expression
$ Pc = '/] + \ ">/I ';
// Perform regular match search
Preg_match ($ pc, $ c, $ content );
// Output the title
Echo $ title [0] [$ I]."
";
Echo $ title [1] [$ I]."
";
$ Concount = count ($ content [0]);
Echo $ concount ."
";
Echo $ content [0] [0];
For ($ j = 0; $ j <$ concount; $ j ++ ){
}
}
?>
After detection, $ c is already the data stream on the content page, but why does the regular expression $ pc only match? <这个字符其他的都没有呢,是因为我上面用了subsrt()函数吗?还是什么问题?麻烦各位大侠指点迷津啊?< p>
The http://www.bkjia.com/PHPjc/319881.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/319881.htmlTechArticle code is as follows :? // Collect the home address $ url = "http://emotion.pclady.com.cn/skills/"; // get the page code $ rs = file_get_contents ($ url ); // Set the matching regular expression // $ fp = fopen ("t...