|
Posted by typingcat on 10/25/05 18:27
I've found that file() and file_get_contents() generates the same
error. However, I found a working way by searching the internet. I can
achieve what I wanted, but I have to deal with dirty HTTP protocal.
Here is the code. I hope this would help the others too.
$fp = fsockopen("www.google.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: www.google.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
Ramon wrote:
> oops, I meant to say file(); not fopen()
>
> Sorry :S
Navigation:
[Reply to this message]
|