1
For billing software, I use WHM Complete solutions which I like a lot. WHMCS provides an API so that external scripts can interface with it. When someone signs up, I would like for the XOOPS sign-up form to interface with WHMCS so as to create a billing account with the same username, password, and other info and was wondering how hard this would be to do? Any thoughts would be appreciated.
Here's the instructions for connecting with the API:
Communicating with the WHMCS API is very simple.
The below code is a PHP code example of how it can be done.
$url = "http://www.yourdomain.com/whmcs/includes/api.php"; # URL to WHMCS API file goes here
$username = "Admin"; # Admin username goes here
$password = "demo"; # Admin password goes here
$postfields["username"] = $username;
$postfields["password"] = md5($password);
$postfields["action"] = "addinvoicepayment";
$postfields["invoiceid"] = "1";
$postfields["transid"] = "TEST";
$postfields["gateway"] = "mailin";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);
$data = explode(";",$data);
foreach ($data AS $temp) {
$temp = explode("=",$temp);
$results[$temp[0]] = $temp[1];
}
if ($result["result"]=="success") {
# Result was OK!
} else {
# An error occured
echo "The following error occured: ".$result["message"];
}
?>
And here's the new client command:
This command is used to add a new client to your WHMCS system.
Attributes
firstname
lastname
companyname - optional
email
address1
address2 - optional
city
state
postcode
country - two letter ISO country code
phonenumber
password2 - password for the new user account
Example Command
$postfields["action"] = "adduser";
$postfields["firstname"] = "Test";
$postfields["lastname"] = "User";
$postfields["companyname"] = "WHMCS";
$postfields["email"] = "demo@whmcs.com";
$postfields["address1"] = "123 Demo Street";
$postfields["city"] = "Demo";
$postfields["state"] = "Florida";
$postfields["postcode"] = "AB123";
$postfields["country"] = "US";
$postfields["phonenumber"] = "123456789";
$postfields["password2"] = "demo";
Returned Variables
clientid - the id of the new user
...