[dns-operations] check if a domain has been registered via DNS

Doug Barton dougb at dougbarton.us
Thu Apr 27 17:33:11 UTC 2017


On 4/27/2017 1:13 AM, Peng Yonghua wrote:
> Hello,
> 
> for domain registration stuff we generally query the info via whois. 
> But whois is slow. I wrote a simple module to query the domain via
> DNS system, more exactly, query the domain from its parent
> nameservers. for example, given yahoo.com, I check the domain name
> from com's nameservers. if rcode is NXDOMAIN then domain not taken.

As others have pointed out, this is not a safe indicator.

> if rcode is NOERROR then domain has taken.

This is also not safe. :)

What would work for your situation is to test for the presence of NS 
records at the registry level, and if they are absent to fall back to 
whois to confirm.

hope this helps,

Doug



More information about the dns-operations mailing list