$file='www.xxx.com.cn';
 $fp = fsockopen($file, 80, $errno, $errstr);
if (!$fp) {
    echo "999";
    echo "$errstr ($errno) <br />\n";
} else {
   fputs($fp,"GET / HTTP/1.0\nHost: $file\n\n");
        while(!feof($fp)) {
                echo file_get_contents($fp);
        }
        fclose($fp);
}报错: 
HTTP/1.1 400 Bad Request Content-Type: text/html Date: Fri, 08 Apr 2011 06:46:11 GMT Connection: close Content-Length: 39
Bad Request (Invalid Hostname)
不知道是什么原因引起的?希望高手帮帮忙!

解决方案 »

  1.   

    Bad Request (Invalid Hostname)
    說明你给的地址不正确吧
      

  2.   

    试一下
    $file='http://www.xxx.com.cn/';
      

  3.   

    不成 报错!
    就该 是$file="www.xxx.com.cn";
      

  4.   

    继续试 GET / HTTP/1.0\r\nHost: $file\r\n\r\n
    另外很怀疑你浏览器看到的是不是缓存……
      

  5.   

    我清除了缓存之后,还是这错误:HTTP/1.1 400 Bad Request
      

  6.   

    i give up...& walk away...