HTTP/1.0 400 Bad Request

clevel

Новичок
HTTP/1.0 400 Bad Request

хочу получить контент через сокеты:
PHP:
  for($i=0;$i<sizeof($proxies);$i=$i+2){
   $fp=fsockopen($proxies[$i],$proxies[$i+1], $errno, $errstr, 5);
   if(!$fp){echo "i|$i| proxy|".$proxies[$i]."|error_str|$errstr| ($errno)<br>\n";}
   else{
    fputs($fp, "GET [url]www.geobytes.com/IpLocator.htm[/url] HTTP/1.0\r\nHost:geobytes.com\r\n\r\n");
    fputs($fp, "Content-Type: application/x-www-form-urlencoded"."\r\n");
    fputs($fp, "Connection: Close\r\n");
    fputs($fp, "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)\r\n");

    $data="GetLocation&cid=0&c=0&Template=".urlencode("iplocator.htm")."&ipaddress=".urlencode("195.131.98.204");
    fputs($fp,"Content-length: ".strlen($data)."\r\n");
    fputs($fp,"Accept: */*\r\n");
    fputs($fp,"\r\n");
    fputs($fp,"$data\r\n");
    fputs($fp,"\r\n");

    while($str=fgets($fp,1024)) echo $str;
    fclose ($fp);
    break;
  } //else
 } //for i
в отчет получаю:
HTTP/1.0 400 Bad Request Content-Type: text/html You are trying to use a node of the CoDeeN CDN Network. While the Host header is generally optional for HTTP, it is required for CoDeeN. Furthermore, numerical hostnames are not allowed. Please add this header and try again.
Чего не правильно ему подсунул?
Массив проксей вот:
$proxies=array("12.107.108.211",8000,
"12.124.242.78",8080,
"12.124.242.78",8081,
"12.135.229.194",8080,
"12.15.46.21",8000,
//"12.154.34.81",80, //ok
"12.166.80.122",80,
"12.208.132.88",80,
"12.32.88.30",80,
"12.44.38.129",8081,
"12.44.87.173",8000,
"12.96.218.205",80,
"128.84.154.49",3128,
"129.186.47.38",8000,
"129.237.123.250",3128,
"134.169.9.108",80);
Если раскоментировать проксю, то выдает:
HTTP/1.0 400 Malformed URL Proxy-agent: Netscape-Proxy/3.52 Date: Mon, 08 Dec 2003 23:38:35 GMT Content-type: text/html Content-length: 157
 

Burunduk-13

[CBT], Старожил РНРClub'a
>Host:geobytes.com\r\n\r\n
Так там надо только один раз перенос строки сделать, а не два:
result: "Host:geobytes.com\r\n"
 

clevel

Новичок
Сократил до:
$fp=fsockopen($proxies[$i],$proxies[$i+1], $errno, $errstr, 5);
$query="GET www.geobytes.com HTTP/1.0\r\n".
"Host: www.geobytes.com\r\n";
fputs($fp,$query."\r\n");

while($str=fgets($fp,1024)) echo $str."<br>\n";
fclose ($fp);
Пишет для разных проксей разное, например,
HTTP/1.0 400 Malformed URL
Proxy-agent: Netscape-Proxy/3.52
Date: Tue, 09 Dec 2003 07:20:33 GMT
Content-type: text/html
Content-length: 157
Malformed URL
Your browser sent a request that this proxy could not understand.

Или:
HTTP/1.1 400 Bad Request
Date: Tue, 09 Dec 2003 07:23:53 GMT
Server: Apache/1.3.9 (Unix) mod_ssl/2.4.2 OpenSSL/0.9.4
Connection: close
Content-Type: text/html
Bad Request
Your browser sent a request that this server could not understand

или

HTTP/1.1 403 Forbidden by rule.
Server: IBM-PROXY-WTE-US/3.6
Date: Tue, 09 Dec 2003 07:44:30 GMT
Connection: close
Accept-Ranges: bytes
Content-Type: text/html; charset=IBM-850
Content-Length: 212
Last-Modified: Tue, 09 Dec 2003 07:44:30 GMT
Expires: Tue, 09 Dec 2003 07:44:30 GMT
Pragma: no-cache
Cache-Control: no-cache



Error 403
 
Сверху