note 110298 deleted from features.commandline.io-streams by googleguy
| From: | googleguy@php.net | Date: | Tue, 09 Oct 2012 09:39:37 +0000 |
| Subject: | note 110298 deleted from features.commandline.io-streams by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191201@lists.php.net to get a copy of this message | ||
Note Submitter: leomac at inbox dot ru
----
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");
?>