$url="http://www.google.com";$fcontents=file_get_contents($url);//第6行
@eregi("<title>(.*)</title>",$fcontents,$rg);//截取内容echo $rg[1];//输出标题有时能正常显示“Google”但也有时会显示:
Warning: file_get_contents(http://www.google.com) [function.file-get-contents]: failed to open stream: HTTP request failed! in E:\Web\htdocs\index.php on line 6

解决方案 »

  1.   

    http://www.google.com
    HTTP请求失败,最近访问google都这样的呢
      

  2.   

    换baidu.com也是,换其他网站还这样
      

  3.   

    我怀疑是不是file_get_contents函数的问题呢?
      

  4.   


    可能头部没通过验证
    试下curl 或者 fsockopen
      

  5.   

    呵呵如果目标是163就不会如果file_get_contents, 太频繁的话不行的.curl或者snoopy好很多.