stdout as input
| From: | Christoph Boget | Date: | Thu, 24 Sep 2009 13:51:56 +0000 |
| Subject: | stdout as input | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-298314@lists.php.net to get a copy of this message | ||
I've read the section in the docs about i/o streams and other related
sections I was able to find but couldn't figure out how to do what I
need. From the command line, I'm trying to pipe stdout in to my php
script which should then see it as input. A simplistic example would
be:
echo bob | myScript.php
In myScript.php, I'm doing:
$handle = popen( 'php://stdin', 'r' );
echo var_export( $handle, TRUE ) . "\n\n";
I've also tried php://stdout and php://input. I also tried eschewing
the php:// pseudo protocol and popen altogether and going with the
STDIN and STDOUT constants. None of that worked. Is there a way I
can pipe/redirect output from a command line uhh, command as input to
my script?
thnx,
Christoph