From f67fa04d8519f1a5122f443b51be7aabe5fbe3ee Mon Sep 17 00:00:00 2001 From: Mark Schouten Date: Fri, 28 Apr 2017 12:32:01 +0200 Subject: [PATCH] This fixes the issues with the newer pdns, which suddenly includes the whole API url in the returned json. Closes #145. In response to https://github.com/tuxis-ie/nsedit/commit/4d4e536d52d93cf41b25bbfe530775dd10c51df9 --- includes/class/ApiHandler.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/includes/class/ApiHandler.php b/includes/class/ApiHandler.php index f21a0ac..07b6cdf 100644 --- a/includes/class/ApiHandler.php +++ b/includes/class/ApiHandler.php @@ -91,15 +91,8 @@ class ApiHandler { break; } - $this->url = str_replace($this->apiurl, '', $this->url); curl_setopt($this->curlh, CURLOPT_URL, $this->baseurl().$this->url); - //print "Here we go:\n"; - //print "Request: ".$this->method.' '.$this->baseurl().$this->url."\n"; - //if ($this->content != '') { - // print "Content: ".$this->content."\n"; - //} - $return = curl_exec($this->curlh); $code = curl_getinfo($this->curlh, CURLINFO_HTTP_CODE); $json = json_decode($return, 1); @@ -117,12 +110,11 @@ class ApiHandler { } public function call() { - if (substr($this->url, 0, 1) == '/') { - $this->apiurl(); - } else { - $this->apiurl = '/'; + if (substr($this->url, 0, 1) != '/') { + $this->url = '/'.$this->url; } - + $this->apiurl(); + $this->url = str_replace($this->apiurl, '', $this->url); $this->go(); } }