Re: stdout as input

From: Date: Thu, 24 Sep 2009 15:28:45 +0000
Subject: Re: stdout as input
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-298317@lists.php.net to get a copy of this message
----- Original Message ---- > From: Christoph Boget <christoph.boget@gmail.com> > To: PHP General <php-general@lists.php.net> > Sent: Thursday, September 24, 2009 6:51:56 AM > Subject: [PHP] stdout as input > > 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 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php Isn't it simpler with http://www.php.net/manual/en/function.shell-exec.php ?

« previous php.general (#298317) next »