I came up with this solution to add a forwarder using the cPanel API that is piped to a script.
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.
include_once "../includes/class/XmlApi_cPanel.php" ;
$host = 'yourhost.com';
$user = 'username';
$password = 'password';
$xmlapi = new xmlapi($host, $user, $password);
$p['domain'] = 'yourhost.com';
$p['email'] = 'beer';
$p['fwdopt'] = 'pipe';
$p['pipefwd'] = '/home/'.$user.'/public_html/parsingScript.php';
#$p['forwarder'] = 'firstname.lastname@example.org=|/home/yourhost/public_html/parsingScript.php';
$res = $xmlapi->api2_query($user, 'Email', 'addforward', $p);
#$res = $xmlapi->api1_query($user, 'Email', 'delforward', $p);
That's my two cents anyway.
Hope it's helpful