I've been looking for a way to work with stdin/stdout for a mod_rewrite's 

There's a working example in Perl, (just returning the input)

$| = 1;
while (<STDIN>) {
       print $_;

I've been trying to achieve this with fopen() read and write the 
php://stdin & php://stdout .

#!/usr/local/bin/php -q
$fp = fopen("php://stdin", "r");
while (($buf = fgets($fp)) != false) {
         $input .= $buf;
$fp = fopen("php://stdout", "w");
         fputs($fp, "$input\n");

But no success.
In the apache man they say
Avoid one common mistake: never do buffered I/O on stdout! This will cause 
a deadloop!
Hence the ``$|=1'' in the above example

Could sommone give  some pointers how I could achieve the perl script above 
in php?


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to