help: need DA api to check if domain exist

jusstakas

Verified User
Joined
Apr 22, 2009
Messages
13
hello,
i need direct admin api to check if a domain is already registered on my server or not. could you help me?



Thank you,
justin
 
I'm not sure if there's an API or not; hopefully someone else will reply as well.

However, DirectAdmin uses the existence of a zone file in /var/named to see if a domain is on the server.

You can also do as root:
Code:
dir -ld /home/*/domains/*
The former won't find domains for which you've deleted DNS, and the latter won't find site-pointers.

Jeff
 
no, this is not api. There is http socket php class, that connects to DA. So i need a function to correspond to that class. for ex: here's a function that shows a user

include 'httpsocket.php';

$sock = new HTTPSocket;

$sock->connect('yoursite.com',2222);
$sock->set_login('admin','password');

$sock->query('/CMD_API_SHOW_ALL_USERS');
$result = $sock->fetch_parsed_body();

print_r($result);

so i need a similar function that checks if a domain exist

Thanks
 
Thank u guys for trying to help me. I've googled around and didn't find any apis to check if domain exist, so i hoped that there in DA forum i'll find the answer. I dont think that it's very difficult to write such a function, maybe someone knows how to. ?
 
Have you actually read my reply? Check the link I've posted, it's exactly what you are looking for.

Code:
Overview	CMD_API_DNS_ADMIN check to see if a domain exists

Code:
CMD_API_DNS_ADMIN
method: GET or POST

domain=domain.com
action=exists

result: exists=1 or exists=0
else error=1&details=some text
 
Yes i did. But i actually don't know how to construct function properly:

Her's the way i'll try:

include 'httpsocket.php';

$sock = new HTTPSocket;

$sock->connect('yoursite.com',2222);
$sock->set_login('admin','password');

$sock->query('/CMD_API_DNS_ADMIN');
$result = ????????

print_r($result);

well, would you try to help me to built it ?
 
Its all documented. Anyway:

PHP:
$sock->query('/CMD_API_DNS_ADMIN', array('domain' => 'doesthisdomainexist.com', 'action' => 'exists'));
$result = $sock->fetch_body();
 
Code:
include 'httpsocket.php';

$sock = new HTTPSocket;

$sock->connect('mysite.lt',2222);
$sock->set_login('admin','mypass');

$sock->query('/CMD_API_DNS_ADMIN', 

array('domain' => 'domainitocheck.lt', 'action' => 'exists'));
$result = $sock->fetch_body();

when i echo $result if a domain exist on my server i get: error=%30&exists=%31 if a domain does not exist, i get error=%30&exists=%30

i dont know if its right or wrong but the last character i guess does the job
 
Last edited:
Back
Top