You want to read from standard input in a command-line context'for example, to get user input from the keyboard or data piped to your PHP program.
Use fopen( ) to open php://stdin, as in Example 23-15.
Reading from standard input
Recipe 25.3 discusses reading data from the keyboard in a command-line context in more detail. Reading data from standard input isn't very useful in a web context, because information doesn't arrive via standard input. The bodies of HTTP post and file-upload requests are parsed by PHP and put into special variables. Non-file-upload post request bodies can also be read with the php://input stream, as discussed in Recipe 8.7.
23.4.4. See Also
Recipe 25.3 for reading from the keyboard in a command-line context; Recipe 8.7 for reading POST request bodies; documentation on fopen( ) at http://www.php.net/fopen.