PHP How to get the specified Web page source code?
I used the file, file_get_contents, curl and other methods, found that can only open their own web site source, other sites baidu.com sina.com.cn all can not get. I don't know what's going on.
For example, with the file_get_contents, the following should be able to succeed Ah. I can't do it when I try.
$str = file_get_contents ($url);
In addition the server php.ini is opened allow_url_fopen.
Reply to discussion (solution)
What did you get out of it?
What did you get out of it?
There's nothing ...
So you
echo file_get_contents (' http://bbs.csdn.net/topics/390455646?page=1#post-394461296 ');
What can you see?
So you
echo file_get_contents (' http://bbs.csdn.net/topics/390455646?page=1#post-394461296 ');
What can you see?
Nothing at all. Take strlen length is also 0 ...
I used the awardspace on the virtual space host. Is there anything except allow_url_fopen that will restrict reading?
There may be some restrictions, use phpinfo () to see