Delete a 'A' record with CMD_API_DNS_CONTROL

UltraMC

New member
Joined
Jan 9, 2014
Messages
3
According to http://www.directadmin.com/features.php?id=504
Delete a record:
CMD_API_DNS_CONTROL?domain=domain.com&action=select&selecttype=encoded
where "selecttype" is one of arecs0, nsrecs0, mxrecs0, cnamerecs0, ptrrecs0 (0 and be any number, generally starting from zero, going up).

and also where "encoded" is the url encoded version of:

name=www&value=1.2.3.4

Basicaly, just replace the =, and & characters to html encoded charctes so that DA doesnt thing they are url separators. Take a look at the html generated in the CMD_DNS_CONTROL page for examples (the code is the same to handel the API and the CMD_API_DNS_CONTROL, it just uses different output).

I execute with no positive results (my A record for X domain with Y value stays as it was), why?

That's my code:

PHP:
$propertyQueryName = "{$conf["SUBDOMAINNAME"]}.{$conf["DOMAINNAME"]}.";
$propertyDeleteEncoded = urlencode("name={$propertyQueryName}&value={$oldIP}");

include 'httpsocket.php';

// connection & settings
$sock = new HTTPSocket;
$sock->connect($conf["SERVERIP"], 2222);

$sock->set_login($conf["USERNAME"],$conf["PASSWORD"]);

$sock->set_method('POST');

// remove old record
$sock->query('/CMD_API_DNS_CONTROL',
	array(
		'action' => 'select',
		'selecttype' => $propertyDeleteEncoded,
		'domain' => $conf["DOMAINNAME"],
	));
 
Just to clarify (as I can't find edit option) my variables:
PHP:
$propertyQueryName = "{$conf["SUBDOMAINNAME"]}.{$conf["DOMAINNAME"]}."; // test.example.com. 
$propertyDeleteEncoded = urlencode("name={$propertyQueryName}&value={$oldIP}"); //name=test.example.com.&value=127.0.0.1
 
Back
Top