Re: Reading STDIN on POST queries?
| From: | Rasmus Lerdorf | Date: | Thu, 04 Jan 2001 17:53:25 +0000 |
| Subject: | Re: Reading STDIN on POST queries? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-32781@lists.php.net to get a copy of this message | ||
Yes, PHP reads in the POST data assuming the data is in POST data format.
If it isn't then you can get this raw data directly from $HTTP_RAW_POST_DATA
-Rasmus
On Thu, 4 Jan 2001, Jeff P wrote:
>
> > Use the constants describe in http://php.net/fopen
> > Or... Hmm, maybe you are asking about $REQUEST_URI?...
> > Look at the output from <?php phpinfo();?> and see if the data you want is
> > there.
>
> Alas, this doesn't seem to work.
>
> The problem, best I can tell, is that PHP is
> parsing STDIN (ie, where Apache sends the data
> from the POST connection) before parsing and
> running the PHP script. The POST data isn't part
> of the URI (that'd be GET), and phpinfo() doesn't
> seem to report what raw data might have existed on
> STDIN.
>
> Ethereal (network sniffer) shows that the data is
> indeed being sent to Apache. Writing a quick perl
> script that reads STDIN shows that the data is
> being sent to the execed CGI process properly.
>
> Within the PHP script, a call to fopen with either
> /dev/stdin or php://stdin succeeds, and feof()
> returns false (meaning not at end of file yet;
> or more precisely, that the pointer into the
> file's buffer hasn't attempted to read past the
> end of the file). fread at this point returns
> nothing, and feof() will then return true (ie, eof
> reached).
>
> Still scratching my head... ??
>
> best,
> Jeff
>
>
>
>
> > > Is there a way to read STDIN directly (ie, without
> > > having PHP 4.0.4 parsing it for encoded
> > > variable/value pairs) in a cgi-based install of
> > > PHP?
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>