Re: Piping into script...
| From: | Steve Werby | Date: | Wed, 21 Nov 2001 04:07:19 +0000 |
| Subject: | Re: Piping into script... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75346@lists.php.net to get a copy of this message | ||
"Ashley M. Kirchner" <ashley@pcraft.com> wrote:
> If I want to pipe, say an incoming email to a PHP script (assuming I
> have php compiled as a cgi binary), how do I deal with when it needs to
> receive the stream of data, how to figure out when there is no more
> coming before it actually start to parse the information?
$fp = fopen( 'php://stdin', 'r' );
Then treat as if its a normal file. There's nothing special to do.
> And how do people deal with multiple requests and such? There may
> be cases where there could be more than one email incoming at the same
> time...while theoretically the MTA only passes them one by one to
> whatever's next in line (whether it's procmail, or any other type of
> program)
I don't think you'll have a problem. Each call to the program should run as
a separate process. If I'm missing something post some more info.
--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/