PHP API for mydnshost.co.uk
Find a file
dependabot[bot] f4744d10fd Bump rmccue/requests from 2.0.13 to 2.0.14
Bumps [rmccue/requests](https://github.com/WordPress/Requests) from 2.0.13 to 2.0.14.
- [Release notes](https://github.com/WordPress/Requests/releases)
- [Changelog](https://github.com/WordPress/Requests/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/WordPress/Requests/compare/v2.0.13...v2.0.14)

---
updated-dependencies:
- dependency-name: rmccue/requests
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-11 20:30:00 +00:00
.github Update automerge.yml to shared 2023-08-09 05:45:37 +01:00
src Fix fatal error if data given is not an array. 2022-11-22 07:13:36 +00:00
.gitignore More composer stuff. 2017-05-19 21:59:31 +01:00
composer.json Bump rmccue/requests from 1.8.1 to 2.0.0 2021-12-31 17:48:02 +00:00
composer.lock Bump rmccue/requests from 2.0.13 to 2.0.14 2024-12-11 20:30:00 +00:00
LICENSE Update LICENSE 2017-05-17 12:43:51 +01:00
README.md Update readme to reflect composer package. 2017-05-19 22:32:32 +01:00

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";
  }