Php information collection program code

Source: Internet
Author: User
After detection, $ c is already a data stream on the content page, but why does the regular expression $ pc match only this character? 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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.