Have you tried either of these, and are you having a problem with one of them?
Sounds like that’s about how to do it. The easiest solution is probably to create a new user, and put the “|php /home/you/yourfile.php” line in a file called “.forward.postfix” in that user’s home directory. All email directed at that user will then be forwarded to the PHP script.
If you don’t want to create a new user, the procmail example would be better, as it would give you more control over what email goes to the PHP script. (eg. only email with a particular subject or destination address.)
Note that the control panel uses procmail to do its email filters, so you can’t use the email filter control panel for a user whose email is being forwarded to procmail.