Re: [PHP3] PHP CGI-Version: read from stdin/pipe From: Sascha Schumann (sascha <email protected>)
Date: 05/01/00

On Mon, May 01, 2000 at 05:33:53AM +0200, Dieter Kneffel wrote:
> Is there a way to handle input from a pipe in php?
>
> Using the CGI-Version of php, I am looking for an
> equal solution to this simple shell-script:
>
> ------ this is an example shell script -------
> #!/bin/sh
> # Read stdin
> #
> while read LINE
> do
> TEXT=${LINE}
> break
> done
> ------ this is an example shell script end-------
>
> $TEXT now contains the piped input.
>
> Anyone did this before?

$fp = fopen("php://stdin", "r");

while(($buf=fgets($fp, 512)) != false) {
...
}

- Sascha

-- 
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest, e-mail: php3-digest-subscribe <email protected>
To search the mailing list archive, go to: http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-list-admin <email protected>