You can also use a .forward file in the home directory of the user on that server. Normally, you can put an email address here to have the email forwarded, but you can also specify a script if you prefix it with a "|".
You want a php script (/usr/local/bin/webmaster-email.php) to get emails sent to "email@example.com".
1) create the user "webmaster" on the server
2) create a /home/webmaster/.forward file and put "|/usr/local/bin/webmaster-email.php" in it (without the quotes)
3) first line of /usr/local/bin/webmaster-email.php should be #!/usr/bin/php (path to your php)
4) chmod 755 /usr/local/bin/webmaster-email.php
The reason it's good to use a system account is that it's nice to control under which user the script will run. You probably don't want to run it as root.
When the script executes, reading from stdin will give you the email.
$email = "";
$fp = fopen('php:///stdin");
while ($line = fgets($fp,1000))
$email .= $line;
//code to handle email...
The email will include all headers - to find subject, just scan the lines untill you find a line starting with "Subject ".
To get the email's body, scan the lines until you find a blank line. The body is after that line.
Where would I put it to handle delivery for a non-user-specific account?
Add to /etc/aliases, e.g: