change or delete dns

skaman

New member
Joined
Feb 23, 2007
Messages
2
Hi to all,
i'm trying to build a web application who permit to change a dns A record.
I haven't find any doc in the official API list (http://www.directadmin.com/api.html), so i've read the original directadmin html code and i've tryed to extract all form value to do my operations.
Now. I can't change directly a DNS A RECORD value. So i need to delete it before. (it's right?)

Now... i tryed the next code (with value extract from original direct admin forms).
PHP:
$sock->connect('myhost',2222);
$sock->set_login('myuser','mypassword');
$sock->set_method('POST');
$sock->query('/CMD_DNS_CONTROL', array( "domain" => "mydomain.tld", "action" => "select", "arecs0" => "name=test&value=&#49&#57&#50.&#49&#54&#56.&#49&#51&#51.&#49&#53"));

Obviously i've wrong something... because this code have no effect on directadmin domains list.
It's correct my action? (select???).
I haven't found any other information in the original form.

How can i solve it?
Thank you
 
ok... the problem was very simple.
i've tryed to send the IP encoded... ("name=test&value=&#49&#57&#50.&#49&#54&#56.&#49&#51&#51.&#49&#53") but it's wrong beacause the DA PHP API do an "urlencode()" before send the data.
Now, if you want to delete a DNS A RECORD the right syntax is:
PHP:
$sock->connect('myhost',2222); 
$sock->set_login('myuser','mypassword'); 
$sock->set_method('POST'); 
$sock->query('/CMD_DNS_CONTROL', array( "domain" => "mydomain.tld", "action" => "select", "arecs0" => "name=test&value=192.168.133.15"));

I hope it can be usefull ;)
 
Back
Top