Currently, i have to check domain availability then someone give me an idea that to use the HTTP return status code.
If domain is available it will return HTTP 404 otherwise the domain is not available.
The question is, Can i just use the HTTP return status code to check availability of the requested domain ?
thanks :) and sorry for my poor English.
(Full disclosure: I'm one of the proprietors of Domainr, which provides an API to do this)
No, unfortunately HTTP status codes won't work for this — an HTTP error would just indicate that an HTTP server isn't responding at the given domain (and port) you're querying.
At a lower level, authoritative domain availability can only be determined by checking the TLD's registry backend (e.g. Verisign runs
.com
, Nominet runs.uk
, etc) by ICANN-accredited registrar entities. (or the ccTLD registries, for country-code domains)DNS almost accomplishes what you're asking (e.g.
NXDOMAIN
means "available"), but there can be false positives where a registered domain doesn't have any associated nameservers. If an occasional false positive is acceptable for your use-case, then doing DNS checks is a fast, free, and straightforward way to accomplish this.Other APIs you could use:
ICANN-accredited reseller programs like Hexonet, OpenSRS, DNSimple, Enom (but you'd need to confirm this is allowed per their Terms of Service)
our API at domainr.build