HTTP/1.1 500 ( Host was not found. For more information about this event, see ISA Server Help. ) Via:1.1 ISA Connection: close Proxy-Connection: close Pragma: no-cache Cache-Control: no-cache Content-Type: text/html Content-Length: 1987 =============显示错误========

解决方案 »

  1.   

    //读取指定网页的内容
    function read_url($url='http://www.xxxx.com/index.php'){
    $hwand = fopen($url,'r');
    $get_content = '';
    while (!feof($hwand)){
    $get_content .= fgets($hwand,4096);
    }
    fclose($hwand);
    if ($get_content!=''){
    printf("取得内容如下:<hr>\r\n%s",$get_content);
    }
    }
      

  2.   

    有些网站对于提交申请的http协议,有要求,比如,发现提交http头之中缺少一些标识,就拒绝返回
    可能fopen函数,省略了某些标识吧,你可以拿socket函数,提交完整的http头就行了
      

  3.   

    代码如下:
    $url = "http://www.abc.com/abc.asp";  $Parten = "/^http:\/\/(.*?)\/(.*)$/i";
        preg_match($Parten,$Url,$Matches);    $ServerName = $Matches[1];
        $FilePath = "/".$Matches[2];    if(empty($ServerName) || empty($FilePath)) return false;    $Parten = "/^(.*?):(\d+)$/i";
        preg_match($Parten,$ServerName,$Matches);    $ServerName = $Matches[1];    $ServerPort = empty($Matches[2])?"80":$Matches[2];    //与服务器通信
        $socket = socket_create(AF_INET, SOCK_STREAM, 0);
        if($socket < 0)
        {
            return false;
        }    $result = socket_connect($socket, $ServerName, $ServerPort);
        if ($result < 0)
        {
            return false;
        }    $in = "GET ".$FilePath." HTTP/1.0\r\n\r\n";
        $out = $Content = "";    socket_write ($socket, $in, strlen($in));
        while ($out = socket_read ($socket, 2048))
        {
            $Content .= $out;
        }
        socket_close ($socket);    $arrContent = split("\r\n\r\n",$Content,2);
        //返回抓取回的内容
        return $arrContent[1];
      

  4.   

    假设php文件:test.php,通过socket 把一些传数传给另一台服务器上的asp文件,asp文件可以获得所传参数!各位帮忙一下,我通过域名访问显示主机不存在,不知道是什么原因,是不是http协议不正确呀
      

  5.   

    用fsockopen和fputs函数你用的那些函数可能不可用....http://www.php.net/manual/zh/function.fsockopen.php这个页面有大量的SOCKET相关代码