• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 891
  • Last Modified:

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!
0
Fatlog
Asked:
Fatlog
1 Solution
 
Brian BushSolutions ArchitectCommented:
Try taking off the very last "\r\n" in the fwrite string.

--brian
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now