Welcome to WebmasterWorld Guest from 54.211.17.91

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Reading the contents of an email that is initiating a PHP script

Reading STDIN

   
9:54 am on Oct 13, 2008 (gmt 0)

5+ Year Member



I have an email address that initiates a php script.

I know the email initiates the script, because I have that script log it into a database.

Now, I'm trying to get the email's contents set as a variable to use in my script.

To do this I'm using STDIN, and this is my first time.

Right now I have a script that contains this line:

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

The $fp variable when logged states "Resource id #6" when I'm expecting the contents of the email instead.

I've tried changing it to this (and similar varients):

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

What the $file variable logges is "". Nothing. I know that there should be something.

I can't get over this stumbeling block. Anyone have any ideas?

If it makes a difference, I'm using PAIR hosting.

12:57 pm on Oct 14, 2008 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



hmm

the return of "Resource id #6" is correct because $fp contains only a file pointer. Whether anything is there is another story all together.

is stdin what you actually want? if so I would try other functions for reading the data.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month