PHP code example of mydnshost / mydnshost-php-api

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

    

mydnshost / mydnshost-php-api example snippets


   $api = new MyDNSHostAPI($config['api']);
  $api->setAuthUserKey('[email protected]', 'AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE');

  $domains = $api->getDomains();
  var_dump($domains);

   $api = new MyDNSHostAPI($config['api']);
  $api->setAuthUserKey('[email protected]', 'AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE');

  $domain = 'test.com';
  $zonedata = file_get_contents('test.com.db');

  echo 'Importing Domain: ', $domain, "\n";

  $result = $api->importZone($domain, $zonedata);
  if (isset($result['error'])) {
    echo 'Unable to import: ', $result['error'];
    if (isset($result['errorData'])) {
      echo ' :: ', $result['errorData'];
    }
    echo "\n"
    continue;
  } else {
    echo 'Success!', "\n";
  }