Re: Reading STDIN on POST queries?
| From: | Cynic | Date: | Fri, 05 Jan 2001 07:48:08 +0000 |
| Subject: | Re: Reading STDIN on POST queries? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-32846@lists.php.net to get a copy of this message | ||
well, why don't you use Perl for this task then? not
everything must be done with a single tool.
At 00:24 5.1. 2001, Jeff P wrote the following:
--------------------------------------------------------------
>> 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
------end of quote------
____________________________________________________________
Cynic:
A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.
cynic@mail.cz