PHP code example of f21 / dnsmadeeasy

1. Go to this page and download the library: Download f21/dnsmadeeasy 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/ */

    

f21 / dnsmadeeasy example snippets



DNSMadeEasy\Autoloader::init();

$client = new DNSMadeEasy\Client('myapikey', 'mysecretkey', true); //The last parameter says to use the sandbox
$result = $client->domains()->add('testdomain.com');

if($result->success){
  //yay!
  var_dump($result->statusCode);
  var_dump($result->body);
}else{
  //:(
  var_dump($result->errors);
}

$result2 = $client->domains()->update($result->body->id, array('gtdEnabled' => true)); //Enable global traffic direct for that domain

if($result2->success){
  //yay!
}else{
  //:(
}

$client->debug(true);