Link to home
Create AccountLog in
Avatar of Fatlog
Fatlog

asked on

fsockopen, fwrite problem

hi,

this isnt really an fsockopen or fwrite problem as such! i'm using the following code...

function http_spawn($page)
{
       $basepath=ereg_replace('[^/]*$', '', $_SERVER['PHP_SELF']);
       $cbSock=fsockopen('localhost', $_SERVER['SERVER_PORT'], $errno, $errstr, 5);
       if ($cbSock)
       {
           fwrite($cbSock, "GET {$basepath}{$page} HTTP/1.1\r\n"
               ."Host: {$_SERVER['HTTP_HOST']}\r\n\r\n");

         while (!feof($cbSock))
      {
            echo fgets($cbSock, 128);
      }

       }
   }

http_spawn("page.php");

to kick off a call to a page. got the code from...

(http://ie.php.net/ignore_user_abort)

anyway, this works fine on one server i tried it on. a redhat linux server(apache 2 i think). works perfectly. then i tried the same code on a different server and i'm getting 404 errors...

HTTP/1.1 404 Not Found Date: Fri, 24 Mar 2006 12:12:15 GMT Server: Apache/1.3.34 (Unix) PHP/4.4.2 mod_ssl/2.8.25 OpenSSL/0.9.7d FrontPage/5.0.2.2635 mod_throttle/3.1.2 Transfer-Encoding: chunked Content-Type: text/html; charset=iso-8859-1 11c
Not Found
The requested URL /page.php was not found on this server.


--------------------------------------------------------------------------------

Apache/1.3.34 Server at Port 80


i've tried changing paths, specifying the path to the file, the url to the file. all sorts of things. am at my wits end with this! anyone see any obviuos errors or anything at all???

thanks!
ASKER CERTIFIED SOLUTION
Avatar of Brian Bush
Brian Bush
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer