Connecting Tech Pros Worldwide Forums | Help | Site Map

Reading incoming HTTP data with PHP socket

Mike Verdone
Guest
 
Posts: n/a
#1: Jul 17 '05
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.

steve
Guest
 
Posts: n/a
#2: Jul 17 '05

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
Chung Leong
Guest
 
Posts: n/a
#3: Jul 17 '05

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