Are you sure you want to close the chat?Chat will be closed and the chat history will be cleared.
continue to sign out,
or stay on chat.
To review this chat session please click this windows.
Chat Online
Chat Online0
Support

Forum

A place for Dynadot and community experts alike to ask questions, share ideas, and more.
My PHP based dynadot API
Posted By c-web
6/4/2007 18:58
<?
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.
Reply Quote
10/26/2007 08:35
See if this thread helps at all:
https://www.dynadot.com/account/forum/f6-engineering-corner/dynadot-api-question-927.html
Reply Quote
10/25/2007 16:06
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
10/25/2007 05:56
"So far I only have search, I'll work on register later."
Reply Quote
10/22/2007 19:05
Does this work/register domains?
Reply Quote
6/5/2007 12:51
Thanks for posting this c-web.
Reply Quote