按照官网上的标准
 <?php
$homepage = file_get_contents('http://www.baidu.com/');
echo $homepage;
?>
为啥echo 不出来东西了,提示Warning: file_get_contents(http://www.baidu.com/) [function.file-get-contents]: failed to open stream: Connection timed out in 

解决方案 »

  1.   

    看看你php.ini中的allow_url_fopen是否为on
      

  2.   

    Connection timed out in  连接超时了.应该是dns或者网络连接有问题,
    还有个就是baidu.com做了手脚..
      

  3.   

    还可以直接抓url啊 学习了
    下面的可以参考
    http://zhidao.baidu.com/question/94794127.html
      

  4.   

    只能说 file_get_contents 不是百发百中