Writing to process STDIN and reading its STDOUT from PHP4?
| From: | Steve Hsieh | Date: | Sat, 16 Sep 2000 22:40:47 +0000 |
| Subject: | Writing to process STDIN and reading its STDOUT from PHP4? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-17046@lists.php.net to get a copy of this message | ||
Can someone explain how I can send STDIN to a *process* and read its STDOUT
from PHP4?
The only function I could find in the manual that seemed relevant was
popen(), but the manual says that it is unidirectional only.
There must be a better way than than writing to a temp file and calling the
process via
popen("process < tmpfile", "r") ... I hope ?
Anyone willing to provide a simple example of the best way to do this?
Suppose, for example, I have a paragraph of text contained in variable
$text, and I want to pass this to the STDIN of a binary called 'program' and
read its STDOUT back into PHP4.
Thanks in advance!