Hi Pete,
I came up with this solution to add a forwarder using the cPanel API that is piped to a script.
Code:
<?php
include_once "../includes/class/XmlApi_cPanel.php" ;
$host = 'yourhost.com';
$user = 'username';
$password = 'password';
$xmlapi = new xmlapi($host, $user, $password);
$xmlapi->password_auth("username", "password");
$xmlapi->set_port(2083);
$xmlapi->set_debug(1);
$p['domain'] = 'yourhost.com';
$p['email'] = 'beer';
$p['fwdopt'] = 'pipe';
$p['pipefwd'] = '/home/'.$user.'/public_html/parsingScript.php';
#$p['forwarder'] = 'beer@yourhost.com=|/home/yourhost/public_html/parsingScript.php';
$res = $xmlapi->api2_query($user, 'Email', 'addforward', $p);
#$res = $xmlapi->api1_query($user, 'Email', 'delforward', $p);
var_dump($res);
?>
The problem I have been having is the 'delforward' works nicely if you are deleting another email address but I haven't worked out how to delete items that work with the pipe method... You will note the port has been changed to the cPanal API as it defaults to the WHM one as I don't have access to a WHM as I'm not a reseller.
That's my two cents anyway.
Hope it's helpful