PHP code example of returnearly / dnsmadeeasy

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

    

returnearly / dnsmadeeasy example snippets



$client = new \DnsMadeEasy\Client;
$client->setApiKey(API_KEY);
$client->setSecretKey(SECRET_KEY);

$client->setEndpoint('https://api.sandbox.dnsmadeeasy.com/V2.0');


// Load the library and dependencies
als
$client = new \DnsMadeEasy\Client;
$client->setApiKey("Your API Key");
$client->setSecretKey("Your Secret Key");

// Configure it to use the Sandbox
$client->setEndpoint('https://api.sandbox.dnsmadeeasy.com/V2.0');

// Create a new domain
$domain = $client->domains->create();
$domain->name = 'mydomain.example.com';
$domain->save();

// Print out our domain
echo json_encode($domain, JSON_PRETTY_PRINT);

// Now fetch a list of our domains
$domains = $client->domains->paginate();
foreach ($domains as $domain) {
    echo json_encode($domain, JSON_PRETTY_PRINT);
}

$client = new \DnsMadeEasy\Client(null, null, $myLogger);

$client->setLogger($myLogger);

$client = new \DnsMadeEasy\Client($myClient);

$client->setHttpClient($myClient);

// Fetch our manager
$domainsManager = $client->domains;
// Ask our manager for the domain
$domain = $domainsManager->get(1234);

// Create a new domain
$domain = $client->domains->create();
$domain->name = 'example.com';

// Save the domain
$domain->save();

// Return the 4th page of results with the default page size
$client->domains->paginate(4);

// Return the first page of 50 results
$client->domains->paginate(1, 50);

// Fetch an existing domain with the ID 1234
$domain = $client->domains->get(1234);
// Update the gtdEnabled property
$domain->gtdEnabled = true;
// Save the domain object on the API
$domain->save();

$domain = $client->domains->get(1234);
$domain->delete();

// Include composer libraries
 = new \DnsMadeEasy\Client;
$client->setApiKey(API_KEY);
$client->setSecretKey(SECRET_KEY);

// Create the domain
$domain = $client->domains->create();
$domain->name = 'example.com';
$domain->save();

// Create a record on the domain
$record = $domain->records->create();
$record->type = \DnsMadeEasy\Enums\RecordType::A();
$record->name = 'www';
$record->value = '192.0.2.1';
$record->save();

// Get a list of all domains
$domains = $client->domains->paginate();
foreach ($domains as $domain) {
    print_r(json_encode($domain, JSON_PRETTY_PRINT));
}