PHP code example of level23 / dynadot-api

1. Go to this page and download the library: Download level23/dynadot-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

level23 / dynadot-api example snippets



use Level23\Dynadot\DynadotApi;

$apiKey = 'xxx YOUR API KEY xxx';

try {
    $api = new DynadotApi($apiKey);
    print_r($api->getDomainInfo('example.com'));
    
    // process your domain info here
} catch (Exception $e) {
    // ... handle exception
}



use Level23\Dynadot\DynadotApi;

$apiKey = 'xxx YOUR API KEY xxx';


try {
    $api = new DynadotApi($apiKey);
    $list = $api->getDomainList();

    print_r( $list );
} catch (Exception $e) {
    // ... handle exception
}



use Level23\Dynadot\DynadotApi;

$apiKey = 'xxx YOUR API KEY xxx';

try {
    $api = new DynadotApi($apiKey);
    $api->setNameserversForDomain('exmple.com', ['ns01.example.com', 'ns2.example.net', 'ns03.example.org']);
    // ...
} catch (Exception $e) {
    // ... handle exception
}


use Level23\Dynadot\DynadotApi;

$apiKey = 'xxx YOUR API KEY xxx';

try {
    $api = new DynadotApi($apiKey);
    print_r($api->getContactInfo(1234)); // 1234 = the contact id, for example returned by the getDomainInfo call.
} catch (Exception $e) {
    echo $e->getMessage();
}



use Level23\Dynadot\DynadotApi;

$apiKey = 'xxx YOUR API KEY xxx';

try {
    $api = new DynadotApi($apiKey);
    $api->setRenewOption('example.com', 'auto');
    // ...
} catch (Exception $e) {
    // ... handle exception
}