The code for file_get_contents is as follows: & nbsp; $ textstrstr (file_get_contents (www. baidu. coms? Wd baidu), find the relevant results); why is there no value for $ text after running; ------ solution ------------------ enter www. baidu file_get_contents in the address bar of your browser
The code is as follows:
$ Text = strstr (file_get_contents (http://www.baidu.com/s? Wd = Baidu '), 'locate the related result ');
Why does $ text have no value after running;
------ Solution --------------------
Do you enter http://www.baidu.com/s in the address bar of your browser? Wd = Baidu
Have you found the related results?
My eyes are not good.
------ Solution --------------------
I can't find the relevant result if you don't say it. the previous results are all above.
Your code is missing.
The best way to do this is regular expressions.
$ Html = file_get_contents ('http: // www.baidu.com/s? Wd = Baidu ');
$ Html = iconv ('gbk', 'utf-8', $ html); // If your page is UTF-8 encoded, a conversion is required.
Preg_match ('/find related results ([0-9,] +)/', $ html, $ math );
Echo $ math [1];