eNom API via PHP and CURL

It’s no secret that we are big fans of eNom. Recently we needed to do an audit of our registrations and of the DNS records we had entered for them. No small task as we manage over 100 domains. As luck would have there is a simple way to proceed – the eNom API.

Our Basic Operation

Quite a simple two step process:

  1. Get List of Domains
  2. Get Host Records for each Domain

A quick PHP script to call these two APIs, one in a loop. Here’s a sample snip:

$uri = 'http://reseller.enom.com/interface.asp?uid=XX&pw=XX';
$buf = `curl '$uri&command=getdomains'`;
$set = extract_domains($buf);
foreach ($set as $dom) {
  $tld = $dom[0];
  $sld = $dom[1];
  $xbuf = `curl '$uri&command=gethosts&tld=$tld&sld=$sld'`;
  echo extract_hosts($xbuf);
}

And with that, detailed host information from all of the domains we manage were dumped and the audit was completed in under 30m.

http://blog.edoceo.com/