Program php information collection program code

WBOY
Release: 2016-07-29 08:39:31
Original
897 people have browsed it

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='/]+" >(.*)/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 content page code
$c=file_get_contents($curl);
//Set content page matching regular rules
$pc='/]+">/i';
//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++){
}
}
?>


Through detection, $c is already the data stream of the content page, but why does the regular expression of $pc only match the character < and nothing else? Is it because I used the subsrt() function above? What else is the problem? Could you please give me some advice?

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!