PDA

View Full Version : Cpanel Accounting PHP module


waising
20-03-2004, 19:04
As most of you know, 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 using these function)

#!/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);



Now,say I want to write a system (call System A) which can work with CPanel.

System A has its own database, it also provides a fucntion, which allows me to create user accounts.
When I create a user account, the account information will be saved into System A's database, and it will also use the functions above (provided by CPanel) to automatically create a same account at CPanel concurrently.

When i create an account at System A, the account will be automatically created at CPanel as well, this one no problem.
But my question is...

when i create an user account at CPanel, I want the same account also be created automatically at my System A's database.
Is it possible or not?
Anyone know how to implement it?

Thanks.