php + stdin
Posted: Fri Aug 12, 2005 8:39 pm
I'm trying to write a script that reads emails and acts as a filter for incoming emails.
When i send an email, i have it setup to go to the script with qmail and the script is being called. however, i cant seem to get the email (neither contents nor headers) sent to the script. From what i've seen, its supposed to be sent in php://stdin which is what i'm trying to read from.
Here's my code:
$fp = fopen('php://stdin', 'r');
$email = fread($fp, filesize('php://stdin'));
fclose($fp);
However i keep getting this error:
PHP Warning: filesize(): Stat failed for php://stdin (errno=2 - No such file or directory) in /home/httpd/vhosts/getbounty.com/redir.php on line 13
I dont know why this is happening.
Here is what i have in my .qmail file :
| /path/to/my/php/script.php
Any help would be much appreciated. Thanks.
When i send an email, i have it setup to go to the script with qmail and the script is being called. however, i cant seem to get the email (neither contents nor headers) sent to the script. From what i've seen, its supposed to be sent in php://stdin which is what i'm trying to read from.
Here's my code:
$fp = fopen('php://stdin', 'r');
$email = fread($fp, filesize('php://stdin'));
fclose($fp);
However i keep getting this error:
PHP Warning: filesize(): Stat failed for php://stdin (errno=2 - No such file or directory) in /home/httpd/vhosts/getbounty.com/redir.php on line 13
I dont know why this is happening.
Here is what i have in my .qmail file :
| /path/to/my/php/script.php
Any help would be much appreciated. Thanks.