Description
Use the delete DNS API to delete DNS Zone on your server.
The API response will be deleted DNS zone deleted.
Parameters
Sample Code
curl --insecure -u "user:password" "https://hostame_or_ip:2005/index.php?api=json&act=dns_zones&delete=1&domain=domain.com"
<?php
$user = 'user_name';
$pass = 'password';
$host = 'serverIP/hostname';
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@'.$host.':2005/index.php?api=json&act=dns_zones';
// You can specify multiple domains with comma (,) separated list of domains
// For example : domain1.com,domain2.com,....
$post = array('delete' => 1,
'domain' => 'domain.com',
);
// Set the curl parameters
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
if(!empty(curl_error($ch))){
echo curl_error($ch); die();
}
// The response will hold a string as per the API response method.
$res = json_decode($resp, true);
// Done ?
if(!empty($res['done'])){
echo "<pre>";
print_r($res['done']['msg']);
echo "</pre>";
}else{
print_r($res['error']);
}
<?php
// Webuzo SDK file
include_once('/usr/local/webuzo/sdk/webuzo_sdk_v2.php');
$user = 'username';
$pass = 'password';
$host = 'serverIP/hostname';
// Create object of Webuzo_Admin_SDK class
$webuzo = new Webuzo_Admin_SDK($user, $pass, $host);
$domain = '123.com';
$res = $webuzo->delete_dns_zone($domain);
// Done/Error
if(!empty($res['error'])){
print_r($res['error']);
}else{
print_r($res['done']['msg']);
}
?>
Output
DNS Zone deleted