From bf513b9ffda5849064ace9ec9034d6c99c6991f4 Mon Sep 17 00:00:00 2001 From: Mark Schouten Date: Wed, 22 Aug 2018 15:21:26 +0200 Subject: [PATCH 1/2] Assume that we have Pdns > 4.x --- includes/class/ApiHandler.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/includes/class/ApiHandler.php b/includes/class/ApiHandler.php index cda5c66..8653974 100644 --- a/includes/class/ApiHandler.php +++ b/includes/class/ApiHandler.php @@ -32,13 +32,7 @@ class ApiHandler { $tmp->url = '/api/v1/servers/localhost'; $tmp->go(); - $v = intval(substr($tmp->json["version"],0,1)); - if ($v == 4) { - $this->apiurl = $tmp->json["url"]; - } else { - throw new Exception("Unsupported API version"); - } - + $this->apiurl = $tmp->json["url"]; } private function curlopts() { From be647cc26a32a986917542ecb58867da8b6f7d37 Mon Sep 17 00:00:00 2001 From: Mark Schouten Date: Wed, 22 Aug 2018 15:39:11 +0200 Subject: [PATCH 2/2] Do not insert 'localhost', we are autodetecting the API url --- includes/class/PdnsApi.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class/PdnsApi.php b/includes/class/PdnsApi.php index 6acaa10..0f9d8b7 100644 --- a/includes/class/PdnsApi.php +++ b/includes/class/PdnsApi.php @@ -64,7 +64,7 @@ class PdnsAPI { if (!isset($zone['serial']) or gettype($zone['serial']) != 'integer') { $api->method = 'POST'; - $api->url = '/localhost/zones'; + $api->url = '/zones'; $api->content = json_encode($zonedata); $api->call();