note 110298 added to features.commandline.io-streams
| From: | leomac at inbox dot ru | Date: | Tue, 09 Oct 2012 09:38:45 +0000 |
| Subject: | note 110298 added to features.commandline.io-streams | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191200@lists.php.net to get a copy of this message | ||
Reading standard input with file_get_contents() requires:
php://stdin in CLI and
php://input in Apache.
Incorrect stream returns just nothing, without any errors.
So:
<?php
# Only in CLI
$f = file_get_contents("php://stdin");
# Only in Apache
$f = file_get_contents("php://input");
?>
----
Server IP: 69.147.83.199
Probable Submitter: 194.85.80.62
----
Manual Page -- http://www.php.net/manual/en/features.commandline.io-streams.php
Edit -- https://master.php.net/note/edit/110298
Del: integrated -- https://master.php.net/note/delete/110298/integrated
Del: useless -- https://master.php.net/note/delete/110298/useless
Del: bad code -- https://master.php.net/note/delete/110298/bad+code
Del: spam -- https://master.php.net/note/delete/110298/spam
Del: non-english -- https://master.php.net/note/delete/110298/non-english
Del: in docs -- https://master.php.net/note/delete/110298/in+docs
Del: other reasons-- https://master.php.net/note/delete/110298
Reject -- https://master.php.net/note/reject/110298
Search -- https://master.php.net/manage/user-notes.php