[Sussex] php problem

John Crowhurst info at johnscomputersupport.co.uk
Tue Sep 29 21:03:09 UTC 2009


Hello,

I wonder if you can help, I'm writing a parser for emails that can be
called from their aliases or procmail but I've hit a problem.

#!/usr/local/bin/php -q
<?php
error_reporting(-1);
$fh=fopen("php://stdin", "r");
$fileh=fopen("/tmp/testmail.out", "w+");
while ($line = fgets($fh)) {
   if (preg_match("/^Subject/", $line) {
     $subject=$line;
   }
   echo $line;
   fwrite($fileh, "$line");
}
fclose($fileh);
?>

If I include the preg_match, I get an error 255. Comment it out and it
runs ok.

I wrote a handler in perl that works like a dream, but the customer wants
it in PHP.

-- 
John Crowhurst
John's Computer Support






More information about the Sussex mailing list