Support

Forum

A place for Dynadot and community experts alike to ask questions, share ideas, and more.
My PHP based dynadot API
<? class Dynadot{ var $version = "1.0"; var $key = "Your API Key"; function search($domains, $combine = false){ $i = 0; $query = ""; foreach($domains as $key => $domain){ $domain = strtolower($domain); if($i == 0){ $query .= "domain".$i."=".$domain; }else{ $query .= "&domain".$i."=".$domain; } $keys[$i] = array($key, $domain); $i++; } $f = file_get_contents('https://www.dynadot.com/api.html?version='.$this->version.'&key='.$this->version.'&command=search&'.$domain); $lines = explode("\n", $f); foreach($lines as $line){ $parts = explode(',', $line); if($parts[3] == 'error' || $parts[3] == 'offline'){ $ret[substr($parts[0], -1, 1)] = '2'; }else{ if($parts[3] == 'yes'){ $ret[substr($parts[0], -1, 1)] = '1'; }else{ $ret[substr($parts[0], -1, 1)] = '0'; } } } if($combine){ foreach($ret as $key => $avail){ $return[$keys[$key]['1']] = $avail; } return $return; }else{ foreach($ret as $key => $avail){ $return[$keys[$key]['0']] = $avail; } return $return; } } } $dynadot = new Dynadot(); //Usage of search: // Function search( array $domains, [bol $combine]); // The domains should be feed into the function VIA array. Example: // $domains = array([0] => 'test.com', [1] => 'hello.net', [2] => 'thisdomainisclearlyavailable.com'); // bol $combine determines the output. If not stated, or if false, it will return an array using the same keys as sent. Using the example above, it will return it using 0 for test.com, 1 for hello.net, and so on. // If set to true, it will use the domain as an array key. // The array it spits out either has a 0, 1 or, 2 for a value. 0 means taken, 1 means available, and 2 means error. $domains = $dynadot->search(array('mydomain.com', 'mydomain.net'), true); print_r($domains); ?> So far I only have search, I'll work on register later. NOTE: I don't have a dynadot API account, so there is no way to test it. I'd like to rely on other people to test it for me, so please let me know if you stumble upon any errors. Thanks.
teamdynadot replied c-web
Thanks for posting this c-web.
Reply Quote
0 Replies
thedomainer replied c-web
Does this work/register domains?
Reply Quote
0 Replies
a_g_portmore_jm replied c-web
"So far I only have search, I'll work on register later."
Reply Quote
0 Replies
thedomainer replied c-web
Missed that part considering I've re-read this thread like 90 times. Wondering if there's anyway to figure out what to do to get a script working!
Reply Quote
0 Replies
kewlceo replied c-web
See if this thread helps at all: [url]https://www.dynadot.com/account/forum/f6-engineering-corner/dynadot-api-question-927.html[/url]
Reply Quote
0 Replies