Hi to all people looking in,
Im pretty new to PHP although i’ve learnt an awful lot in the last few days of playing around and researching.
So far what I have is an pipe email to php script set up (that works fine). I’ve got this from the web, which im using now:
[php]$fd = fopen(“php://stdin”, “r”);
$email = “”;
while (!feof($fd))
{
$email .= fread($fd,1024);
}
fclose($fd);
[/php]
What i need to do is search the email that has been retrieved for a string using regex. I’ve tried using preg_match to do it but i believe due to the $email variable being empty i am not getting a match.
[php]preg_match(’/http/’, $email, $match);[/php]
I’ve also added to the end of my code:
[php]$fdw = fopen(“email.txt”, “w+”);
fwrite($fdw, $email);
fclose($fdw);[/php]
which works fine, and saves the email to a text file. So i cant figure out why writing $email works but searching $email with preg_match doesnt.
Please if anybody could shed some light, I would be very grateful.
Thankyou very much!