so If I want to create one for Adding and Removing of a domain I am guessing it would be
/usr/local/cpanel/hooks/AddonDomain/addaddondomain
/usr/local/cpanel/hooks/AddonDomain/deladdondomain
??
In this xml sample on that site
Function Hooks
PHP Code:
<xml>
<cpanelevent>
<errors></errors>
<event>addpop</event>
<module>email</module>
<params>
<param0>emailuser</param0>
<param1>emailpassword</param1>
<param2>250</param2>
<param3>testdomain.com</param3>
</params>
</cpanelevent>
<CPDATA>
<DOMAIN>testdomain.com</DOMAIN>
<USER>testdoma</USER>
</CPDATA>
</xml>
its specifically for email accounts - but I am guessing that the CPDATA nodes will always be there for any action - but the cpanelevent nodes will be different each time right?
is there a way to get a list of what nodes will come back, what paramaters are passed in, in what order so that I can properly get the values and create an association?
Is it safe to assume that if there is nothing in the errors node that the request was successfull - or will it always be sucessfull if it gets to this point and calls my hook ?
PHP Code:
$xml = "";
//read in STDIN and convert to XML String
$stdin_fh = fopen('php://stdin', 'r');
while ($line = fgets( $stdin_fh )) {
$xml .= $line;
}
fclose($stdin_fh);
/*
<xml>
<cpanelevent>
<errors></errors>
<event>addpop</event>
<module>email</module>
<params>
<param0>emailuser</param0>
<param1>emailpassword</param1>
<param2>250</param2>
<param3>testdomain.com</param3>
</params>
</cpanelevent>
<CPDATA>
<DOMAIN>testdomain.com</DOMAIN>
<USER>testdoma</USER>
</CPDATA>
</xml>
*/
$xml_string = new SimpleXMLElement($xml);
$eventName = $xml_string->xml->cpanelevent->event;
$moduleName = $xml_string->xml->cpanelevent->module;
$param0 = $xml_string->xml->cpanelevent->params->param0;
$param1 = $xml_string->xml->cpanelevent->params->param1;
$param2 = $xml_string->xml->cpanelevent->params->param2;
$param3 = $xml_string->xml->cpanelevent->params->param3;