buy
Create DNS

Description

Use the Create DNS API to create DNS Zone on your server.

The API response Will be Created DNS Zone.

Parameters

Sample Code

curl --insecure -u "user:password" "https://hostname:2005/index.php?api=json&act=dns_zones&add=1&domain=domain.com&ipv4=1.1.1.1&user=user_name"
<?php
$user = 'user_name';
$pass = 'password';
 
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@hostname:2005/index.php?api=json&act=dns_zones';  

$post = array('add' => 1,
              'domain' => 'domain.com',
              'user' => 'usrer_name',
              'ipv4' => '1.1.1.1',
);

// 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);

// The response will hold a string as per the API response method. In this case its PHP Serialize
$res = json_decode($resp, true);

// // Done ?
if(!empty($res['done'])){
    print_r($res['done']['msg']);
}else{
    print_r($res['error']);
}
<?php
include_once('/usr/local/webuzo/sdk/webuzo_sdk_v2.php');
$user = 'uer_name';
$pass = 'password';
$host = 'hostname';

$webuzo = new Webuzo_Admin_SDK($user, $pass, $host);

$domain = "domain.com";
$address = "1.1.1.1";
$user_name = "user_name";
$resp = $webuzo->add_dns_zone($domain, $address, $user_name);

// Done/Error
if(!empty($resp['error'])){
	print_r($resp['error']);
}else{
	print_r($resp['done']['msg']);
}
?>

Output

The DNS Zone was added successfully
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list