Using the Cpanel Accounting php moduleExample: createacct ($host,$user,$accesshash,$usessl,$acctdomain,$acctuser,$acctpass,$acctplan);
For security reasons if you are connecting to a remote server you should set the usessl argument to 1. You must have the curl+ssl module installed for this to work.
Cpanel Accounting supports the following methods:
showversion - Shows what version of WHM the remote server is running.
listaccts - Lists currently active accounts.
listpkgs - Lists packages avalible for creation.
createacct - Creates a new account on the server.
killacct - Terminates an account on the server.
suspend - Suspends an account on the server.
unsuspend - Unsuspends an account on the server.
Below is a sample php program.
#!/usr/local/cpanel/3rdparty/bin/php <?php require '/usr/local/cpanel/Cpanel/Accounting.php.inc'; $host = "localhost"; $user = "<USERNAME HERE>"; $accesshash = '<REMOTE ACCESS KEY HERE>'; $accts = listaccts($host,$user,$accesshash,0); print_r($accts); $pkgs = listpkgs($host,$user,$accesshash,0); print_r($pkgs); ?>