Re: Pipe
| From: | Teodor Cimpoesu | Date: | Sat, 23 Sep 2000 12:34:17 +0000 |
| Subject: | Re: Pipe | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-17424@lists.php.net to get a copy of this message | ||
Hi Yurais!
On Thu, 21 Sep 2000, Yurais Fernandez Leal wrote:
>
> How can I pipe a file through PHP
> Example
>
> I have a text file, I want to add it to a field in a Database, but
> using a PHP Script through pipe
>
> cat file.txt|todb.php
>
> How would PHP get the information been piped ?
>
> I know it's easy to do in Perl, but I know nothing about Perl...
PHP - PPL Hate Perl :)
`|' means you will have the data on the stdin.
to open the stdin in PHP use "php://stdin" special name as an
argument to fopen(), then read until fgets/fread fails with `false'
meaning no more data.
good luck.
-- teodor