Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am looking to incorporate a domain name lookup facility in my website to make sure if a domain is available or not. The only api I could find on the net is http://www.domaintools.com/api/docs/domain-search/ . But this is paid. Is there any other api available which might be cheaper / free.

I am working with php, query.

share|improve this question
    
Suggest @Jacek's answer - but may be helpful if you say which language you're working in for more appropriate suggestions of libraries/etc. :) –  TZHX Oct 25 '11 at 12:05
    
@TZHX - updated my answer –  Imran Omar Bukhsh Oct 25 '11 at 12:51

4 Answers 4

up vote 6 down vote accepted

You can simply do DNS queries yourself. You would just have to always start at top (so called root servers) and work your way down the domain name, to be sure it does exist. Don't know what language you're using, but most languages out there have apropriate libraries for the job. Sure it requires some knowledge about DNS system itself, but since you are querying DNS system directly, you can be sure it is and will remain free.

share|improve this answer
4  
+1 - there's definitely features for this in C#/VB (for ASP) in the System.Net namespace. PHP also has a dns_get_record function. Python has it in the socket namespace... so whatever language you use, there'll almost certainly be a core library providing DNS features. –  TZHX Oct 25 '11 at 12:02
    
This will tell if you the name resolves, but not who owns it. Also, I'm not sure what the advantage of this would be over just querying your computer's configured caching DNS server (i.e. just doing a normal DNS lookup). –  Dean Harding Oct 25 '11 at 12:07
    
@DeanHarding Well... the question was how to find if a domain does exist or not, not who owns it. And as for the normal DNS lookup, client computers do a lot of DNS caching (even browsers have their own cache to save some time and bandwith) which might (under some circumstances) provide you with a false answer. Direct querying will always be true. –  Jacek Prucia Oct 25 '11 at 12:19

The WHOIS protocol is free and a number of servers exist which you can query. I would suggest you actually start at the wikipedia page, because it's got a fairly good introduction and pointers to further information.

share|improve this answer

I don't know if there is a free one, but you can always write your own. Within your code, submit a form to for example http://www.whois.net/ and scrap the resulting HTTP response. On that particular website, when the domain is free it shows "Domain name is not currently registered. Available for you now!". Look for this value in the response. If you find this string it means that the domain is already taken (then you can scrap additional information on who registered the domain), otherwise it is free. It is your choice then to either return a true/false value or more detailed information if you want to scrap more data when the domain is taken.

It's really only a few lines of code. Although if there is a free API, by all means, use it.

share|improve this answer
    
I notice whois.net block you if they notice you are sending many request. Others like network solutions put a token on the request page. So don't think this method will work. –  user836026 Feb 16 at 16:22

A domain is available or not may mean two different concepts

  1. Domain is available for registration
  2. Domain has a valid presence on DNS system (eg. has a website, can accept email etc.)

You mention about domaintools, hence probably you are interested in concept 1 mentioned above.

The most reliable way to find out whether a domain is available for registration or not is to query whois server for that TLD or ccTLD. Query to whois servers is always free. Although there may be strict limitations as to how many queries can be made per min/hour etc.

Finding out availability based on DNS is not reliable. It is possible that a domain may not have nameservers set with the registrars, in that case the response from DNS server would be "domain does not exists" though the domain is not available for registration.

ProgrammableWeb has a good collection of domain related apis here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.