I'm in the process of playing with your script, and I thought I'd share what I've come up with -- it's not refined yet, but I got it working, and I couldn't find this information laid out anywhere specifically...
I wanted to add some of the cPanel API2 stuff. The first thing I thought I'd test was to add a forwarder.
The first thing I did was add a nastly little hacked function to your class:
I used the example init and result/error display code, and hacked in this function call:
# Function to pass xml to cpanel
function cpxml($user, $xml)
$cp_xml = '/xml-api/cpanel?user=' . $user . '&xmlin=' . $xml;
//connect using prpoer xml api address
//get the output
$result = $this->getOutput();
It's also ugly, but I was having a heck of a time figuring out how to get it working.
$cp_user = 'someuser';
$cp_xml_start = '<cpanelaction>';
$cp_xml_module = '<module>Email</module>';
$cp_xml_function = '<func>addforward</func>';
$cp_xml_version = '<apiversion>2</apiversion>';
$cp_xml_args = '<args><fwdemail>firstname.lastname@example.org</fwdemail><fwdopt>fwd</fwdopt><domain>some.tld</domain><email>someone</email></args>';
$cp_xml_end = '</cpanelaction>';
$cp_xml = $cp_xml_start . $cp_xml_module . $cp_xml_function . $cp_xml_version . $cp_xml_args . $cp_xml_end;
Part of that was because in the original function, I didn't have "?user=", I just had "?", so I wasn't passing it a cpanel user to work with. D'oh!
But still, I just couldn't find this laid out and written clearly anywhere.... so I hope you don't mind it in this thread - I hope this saves someone some time.
Some resources I used: