[Sussex] php problem
Paul Turner
paul.turner at rentokil-initial.com
Wed Sep 30 08:52:49 UTC 2009
Ho John,
You are missing the closing bracket on the if( statement.
if (preg_match("/^Subject/", $line) {
should be:
if (preg_match("/^Subject/", $line)) {
Regards, Paul.
-----Original Message-----
From: sussex-bounces at mailman.lug.org.uk
[mailto:sussex-bounces at mailman.lug.org.uk] On Behalf Of John Crowhurst
Sent: 29 Sep 2009 22:03
To: sussex at mailman.lug.org.uk
Subject: [Sussex] php problem
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
__
Sussex mailing list
Sussex at mailman.lug.org.uk
E-mail Address: sussex at mailman.lug.org.uk
Sussex LUG Website: http://www.sussex.lug.org.uk/
https://mailman.lug.org.uk/mailman/listinfo/sussex
More information about the Sussex
mailing list