here is the dns_templatezone_add.php example. Code: if($session_id = $client->login($username, $password)) { echo 'Logged successfull. Session ID:'.$session_id.'<br />'; } //* Set the function parameters. $client_id = 1; $template_id = 1; $domain = 'test.tld'; $ip = '192.168.0.100'; $ns1 = 'ns1.testhoster.tld'; $ns2 = 'ns2.testhoster.tld'; $email = 'email.test.tld'; $id = $client->dns_templatezone_add($session_id, $client_id, $template_id, $domain, $ip, $ns1, $ns2, $email); echo "ID: ".$id."<br>"; if($client->logout($session_id)) { echo 'Logged out.<br />'; } and the request I am sending to the server is like this(post request) Code: {"session_id":"c1662e64aee1ece4e1832485e269c052","client_id":1,"template_id":"2","domain":"testdomain_xyz","ip":"162_471_141_17","ns1":"ns1_example_com","ns2":"ns2_example_com","email":"info@xyz_com"} '' more details: Code: Request Body Name Value Content Type 'application/x-www-form-urlencoded' Raw '{\"session_id\":\"c1662e64aee1ece4e1832485e269c052\",\"client_id\":1,\"template_id\":\"2\",\"domain\":\"testdomain.xyz\",\"ip\":\"162.471.141.17\",\"ns1\":\"ns1.example.com\",\"ns2\":\"ns2.example.com\",\"email\":\"[email protected]\"}' Decoded to Params [ '{\"session_id\":\"c1662e64aee1ece4e1832485e269c052\",\"client_id\":1,\"template_id\":\"2\",\"domain\":\"testdomain_xyz\",\"ip\":\"162_471_141_17\",\"ns1\":\"ns1_example_com\",\"ns2\":\"ns2_example_com\",\"email\":\"info@xyz_com\"}' => '' ] but I am getting a blank response from the server. what I am missing here.
Hi Till, okay. but no DNS record is created on the server. as well the below code suggests that I should get an id as response. echo "ID: ".$id."<br>"; Code: try { if($session_id = $client->login($username, $password)) { echo 'Logged successfull. Session ID:'.$session_id.'<br />'; } //* Set the function parameters. $client_id = 1; $template_id = 1; $domain = 'test.tld'; $ip = '192.168.0.100'; $ns1 = 'ns1.testhoster.tld'; $ns2 = 'ns2.testhoster.tld'; $email = 'email.test.tld'; $id = $client->dns_templatezone_add($session_id, $client_id, $template_id, $domain, $ip, $ns1, $ns2, $email); echo "ID: ".$id."<br>"; if($client->logout($session_id)) { echo 'Logged out.<br />'; } } catch (SoapFault $e) { echo $client->__getLastResponse(); die('SOAP Error: '.$e->getMessage()); } any place where I can see the logs, where it is failing?
Additional Info: I am always getting: logged out if I am adding this: PHP: if($this->restCall('logout',$this->session_id)) { return 'Logged out.<br />';} full code for dns_templatezone_add PHP: public function AddDns($domain){ $result = $this->restCall('login', array('username' => $this->remote_user, 'password' => $this->remote_pass, 'client_login' => false)); if($result) { $data = json_decode($result, true); if(!$data) die("ERROR!\n"); $this->session_id = $data['response'];} $id = $this->restCall('dns_templatezone_add',['session_id' => $this->session_id, 'client_id'=>1, 'template_id'=>2, 'domain'=>$domain, 'ip'=>'162.471.141.17', 'ns1' => 'ns1.example.com', 'ns2' => 'ns2.example.com', 'email' => 'info.xyz.com', ]); if($id){ return "ID: ".$id."<br>"; } if($this->restCall('logout',$this->session_id)) { return 'Logged out.<br />';}} and code for curl call PHP: private function restCall($method, $data) { $remote_url=self::remote_url; if(!is_array($data)) return; $json = json_encode($data); $curl = curl_init(); curl_setopt($curl, CURLOPT_POST, 1); if($data) curl_setopt($curl, CURLOPT_POSTFIELDS, $json); // needed for self-signed cert curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); // end of needed for self-signed cert curl_setopt($curl, CURLOPT_URL, $remote_url . '?' . $method); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($curl); curl_close($curl); return $result;} Note: The request is going to the server correctly as for the first request I am getting the session_id did I missed something?
I believe I am sending the request correctly. as I have added the response from the function to see how it is moving at various steps including just before the exit line in the end of function - dns_templatezone_add - I added "response from dns_templatezone_add" and I am getting the same response without any other error. so I am wondering why the request is not creating the DNS records.
I've never used that API function and I guess it's not widely used, I'll always create the records one by one using the API.