buy
Add A Record

Description

Use the following API to add A record.

Parameters

Sample code

Please refer following sample code for CURL and API.

curl --insecure -d "create_record=1" -d "domain=DOMAIN" -d "name=DNS_NAME_PREFIX" -d "ttl=TTL" -d "selecttype=PTR" -d "address=PTR_ADDRESS" -u "ROOT:PASSWORD" -X POST "https://HOSTNAME_OR_IP:2005/index.php?api=json&act=advancedns"
<?php
$user = 'username';
$pass = 'password';
 
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@hostname:2005/index.php?api=json&act=advancedns';  

$post = array('create_record' => 1,
              "domain=DOMAIN"
              'name' => 'DNS_NAME_PREFIX',
              'ttl' => 'TTL',
              'selecttype' => 'PTR',
	      'address' => 'PTR_ADDRESS'
);

// 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']);
}

Output

Record added
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list