fsockopen, fwrite problem


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);



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


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/ 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???

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brian BushSolutions ArchitectCommented:
Try taking off the very last "\r\n" in the fwrite string.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.