Weird fopen() problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • milan.topalov@googlemail.com

    #1

    Weird fopen() problem

    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:


    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\xb 7@\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.c o.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";
    }
    ?>

Working...