I've been looking for a way to work with stdin/stdout for a mod_rewrite's
rewritemap.
There's a working example in Perl, (just returning the input)
#!/usr/bin/perl
$| = 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
<?php
$fp = fopen("php://stdin", "r");
while (($buf = fgets($fp)) != false) {
$input .= $buf;
}
fclose($fp);
$fp = fopen("php://stdout", "w");
fputs($fp, "$input\n");
fclose($fp);
?>
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?
TIA
Jim.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php