FW: [PHP] Using PHP to post the contents of an email to MySql dat abase
| From: | Mullin, Reginald | Date: | Fri, 11 Jan 2002 21:42:39 +0000 |
| Subject: | FW: [PHP] Using PHP to post the contents of an email to MySql dat abase | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-80235@lists.php.net to get a copy of this message | ||
> Hi Guys,
>
> I've written the following program to write an email from PHP Standard
> Input to an html file:
>
> **************************************************************************
> ***
> <?php
> $file = "php://stdin";
> $fp = @fopen($file,"rb");
> if ($fp){
> $contents = fread($fp,filesize($file));
> $fw = @fopen ("/www/htdocs/pgs/htm/stdin.htm", "wb+");
> if ($fw){
> flock($fw, 1);
> fwrite($fw, $contents, filesize($file));
> fclose($fw);
> } else {
> print "The file stdin.htm does not exist!";
> }
> @fclose($fp);
> } else {
> print "The file php://stdin does not exist!";
> }
> ?>
> **************************************************************************
> ***
>
> However, whenever the email attempts to access the program, the
> mailer-daemon returns the following error message:
>
> **************************************************************************
> ***
> The original message was received at Fri, 11 Jan 2002 15:01:34 -0500
> from [63.105.171.52]
>
> ----- The following addresses had permanent fatal errors -----
> "|php -q /www/htdocs/exe/php/Email2MySql.php"
> (expanded from: <Email2MySql@iamhewhois.org>)
>
> ----- Transcript of session follows -----
> sh: php: command not found
> 554 "|php -q /www/htdocs/exe/php/Email2MySql.php"... unknown mailer error
> 127
> **************************************************************************
> ***
>
> What am I doing wrong here? Did I screw up the alias? Does my system not
> support this functionality? HELP.
>
> P.S. My virtual server is running Linux.
>
>
>
> O From Now 'Till Then,
> \-> Reginald Alex Mullin
> /\ 212-894-1690
>
> -----Original Message-----
> From: bvr@xs4all.nl [SMTP:bvr@xs4all.nl]
> Sent: Friday, January 11, 2002 12:30 PM
> To: php-general@lists.php.net; Mullin, Reginald
> Subject: Re: [PHP] Using PHP to post the contents of an email to
> MySql database
>
>
>
> on linux, you could simply open these 'files':
>
> /dev/stdin
> /dev/stdout
>
> for windows, and for portability, PHP provides the following dummy's,
> which can also simply be used by fopen() :
>
> php://stdin
> php://stdout
>
>
> bvr.
>
>
>
> On Fri, 11 Jan 2002 12:19:05 -0500, Mullin, Reginald wrote:
>
> >Hi Guys,
> >I recently read an email entitled "Can a PHP program receive an e-mail
> and
> >write it to a file???" in the PHP archives (see
>
> >>http://marc.theaimsgroup.com/?l=php-general&m=97986044121868&w=2)
> >and
> wanted
> >to ask a follow up question. I'm a novice programmer, new to PHP, and
> >unfamiliar with the ways in which to access the Standard Input for a PHP
> >program. Can anyone provide me with some examples or online reference
> >material as to how I can go about doing this. For example, is there a
> >particular variable or function that I should call? Or, is there
> something
> >that needs to be initialized?
> >P.S. Thanks, in advance, for all of your help and assistance.
> >
> >O From Now 'Till Then,
> >\-> Reginald Alex Mullin
> >/\ More Questions than Answers
> >
> >
> >
> >**********************************************************************
> >This email and any files transmitted with it are confidential and
> >intended solely for the use of the individual or entity to whom they
> >are addressed. If you have received this email in error please notify
> >the postmaster at postmaster@sothebys.com.
> >
> >
> >www.sothebys.com
> >**********************************************************************
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> >For additional commands, e-mail: php-general-help@lists.php.net
> >To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
> >
>
>
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the postmaster at postmaster@sothebys.com.
www.sothebys.com
**********************************************************************