|
From: <php...@li...> - 2010-02-07 00:00:01
|
Hello!
The apache server sends garbage if you send http 1.0 but expect http 1.1.
The following code will work:
$sock = fsockopen(...);
fwrite($sock, "GET /foo.php HTTP/1.1\r\nHost: localhost\r\n\r\n");
while(fgets($sock)!="\r\n");
while($len=hexdec(fgets($sock))) {
for($str=fread($sock, $len); $len>strlen($str); $str.=fread($sock, $len-strlen($str)));
echo $str;
}
Peter
|