[SOLVED] Get ENOM balance into WHMCS

November 29, 2016

I have been running WHMCS for a while now and have had to keep logging into ENOM to get my balance which is a hassle as I have two factor auth and security questions setup so takes me a minute to get through all of that.

Here is some php script you can put in a WHMCS widget to display your enom balance in your admin dashboard saving you some time.

We are using simplexml to parse the results.

//define your credentials
$enom_username = "joe.bloggs";
$enom_password = "ilovejanebloggs";

//define the api url
$enom_api_url = "https://reseller.enom.com/interface.asp?command=GetBalance&uid=".$enom_username."&pw=".$enom_password."&ResponseType=XML";

//fetch the data from enom
$response = file_get_contents($enom_api_url);

//use simplexml to parse the data
$response = simplexml_load_string($response) or die("Error getting the ENOM balance.");
$content .= "<strong>ENOM Balances</strong><br>";
$content .= "Total Domains: " . $response->DomainCount . "<br>";
$content .= "Available Balance: " . $response->AvailableBalance . "<br>";

echo $content;

Result will be something like this.