Connecting Tech Pros Worldwide Help | Site Map

Reading incoming HTTP data with PHP socket

  #1  
Old July 17th, 2005, 11:49 AM
Mike Verdone
Guest
 
Posts: n/a
Hello all,

I'm trying to implement a PHP program that can handle streaming HTTP
data through Apache. I need to somehow get access to the incoming data
of the HTTP request as it arrives (i.e. I don't want to access the
FILE array).

Is this possible with mod_php? I think that, in general, it should be
possible as I think mod_python can do it.

Thanks,

Mike.
  #2  
Old July 17th, 2005, 11:49 AM
steve
Guest
 
Posts: n/a

re: Reading incoming HTTP data with PHP socket


"user3201" wrote:[color=blue]
> Hello all,
>
> I'm trying to implement a PHP program that can handle
> streaming HTTP
> data through Apache. I need to somehow get access to the
> incoming data
> of the HTTP request as it arrives (i.e. I don't want to access
> the
> FILE array).
>
> Is this possible with mod_php? I think that, in general, it
> should be
> possible as I think mod_python can do it.
>
> Thanks,
>
> Mike.[/color]

Use fsockopen, and then use fget in a loop to catch the stream:
http://ca.php.net/manual/en/function.fsockopen.php

--
Posted using the http://www.dbforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbforumz.com/PHP-Reading-...ict189433.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=640398
  #3  
Old July 17th, 2005, 11:51 AM
Chung Leong
Guest
 
Posts: n/a

re: Reading incoming HTTP data with PHP socket


"Mike Verdone" <mike.verdone@gmail.com> wrote in message
news:5487f95e.0501191347.272752f0@posting.google.c om...[color=blue]
> Hello all,
>
> I'm trying to implement a PHP program that can handle streaming HTTP
> data through Apache. I need to somehow get access to the incoming data
> of the HTTP request as it arrives (i.e. I don't want to access the
> FILE array).
>
> Is this possible with mod_php? I think that, in general, it should be
> possible as I think mod_python can do it.[/color]

It is not possible with mod_php. PHP will always read in the entire request
before starting your script. If you setup the command line version of PHP as
a CGI script, you can access the raw request through stdin. That's really a
hack though. If mod_python can do it, let mod_python do it.


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
reading http request raw data as stream AviCoh@gmail.com answers 4 December 20th, 2006 01:55 AM
Understanding socket_select routine mydejamail@yahoo.co.uk answers 4 June 7th, 2006 02:55 PM
Manageing multiple socket connections Gabriele Farina answers 7 July 17th, 2005 05:02 AM
$_SERVER returns empty value tornado answers 3 July 17th, 2005 03:27 AM