Ei kuvausta

dependabot-preview[bot] 38d0ae9aee Upgrade to GitHub-native Dependabot 4 vuotta sitten
.github 38d0ae9aee Upgrade to GitHub-native Dependabot 4 vuotta sitten
src c6728e4148 Fix BlockRegex CRUD. mydnshost/mydnshost-api#127 4 vuotta sitten
.gitignore 8cac8eb499 More composer stuff. 8 vuotta sitten
LICENSE 592c8ce482 Update LICENSE 8 vuotta sitten
README.md 4367f97d78 Update readme to reflect composer package. 8 vuotta sitten
composer.json 7b73aac0d3 Add missing methods. 8 vuotta sitten
composer.lock 392e17d6f9 [Security] Bump rmccue/requests from 1.7.0 to 1.8.0 4 vuotta sitten

README.md

mydnshost-php-api

PHP API for mydnshost.co.uk

At the moment this is a very simple library, will composerise this in future and add some kind of cli client wrapper around it.

This implements version 1.0 of the API as documented at https://api.mydnshost.co.uk/1.0/docs/

Installation is via composer require mydnshost/mydnshost-php-api

Example usage, listing domains:

  require_once(__DIR__ . '/vendor/autoload.php');
  $api = new MyDNSHostAPI($config['api']);
  $api->setAuthUserKey('admin@example.org', 'AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE');

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

Example usage, importing zone files:

  require_once(__DIR__ . '/vendor/autoload.php');
  $api = new MyDNSHostAPI($config['api']);
  $api->setAuthUserKey('admin@example.org', '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";
  }