Posted by milan.topalov on 03/21/07 09:47
I'm having some strange problems using fopen() to fetch website
content.
It seems I can't open URL shorter then certain lenght.
I can open this:
http://groups.google.co.uk/groups/dir?lnk=od&h=en&sel=&x=sssssxsssq
But if I delete a character from the end, fopen() failes after 20 sec
and returns strange error:
....failed to open stream: HTTP request failed! \xf4\xff$ in...
....failed to open stream: HTTP request failed! \x94\x93\xeb in...
....failed to open stream: HTTP request failed! \xa0\x82\xfa\xb7@\x18%
in...
I mean, what is up with that? Any ideas?
Thanks!!
Server is running Apache 2.0.59, PHP 5.1.6 on CentOS 4.4. The same
thing happened when box was running Fedora Core 5.
This is the code I'm testing with:
<?php
$url = "http://groups.google.co.uk/groups/dir?
lnk=od&h=en&sel=&x=sssssxsssq";
echo strlen($url);
if ($fp = fopen($url,"r"))
{
while (!feof($fp))
{
$buffer = fgets($fp, 4096);
echo $buffer;
}
}
else
{
echo "ERR";
}
?>
[Back to original message]
|