I want to integrate one API with one of my website which is a task given by my senior.The API is about searching domain name already present or not..please help me on this topic
please give me n example which i can refer.my website is in PHP.
I want to integrate one API with one of my website which is a
Share
[EDIT 2] As @Poe mentions in his comment, gethostbyname is probably a much better solution because it works for any top level domain, since it performs a DNS query instead of a whois query, and is also much simpler to implement and probably faster:
Anyway, a domain can be registered but its not linked to any computer (E.g. although it’s very uncommon, you may get an resolution for http://www.example.com but not example.com)
[EDIT] I didn’t post this before because I was having some trouble connecting to whois.internic.net on port 43 to perform a whois query (thought they had shutdown the service for good). Anyway, here’s a fsockopen based solution I just coded, which I think is far better and simpler than the solution I gave before using their CGI web script. Hope it helps (Usage: myqueryscript.php?domain=domainiwanttocheck.com):
From internic website, this is the html code to implement a whois query:
This means you can send a whois query like this: http://reports.internic.net/cgi/whois?whois_nic=domainiwanttocheck.com&type=domain
You can send the query from your script and store the response on a DOMDocument object. Check out: http://www.php.net/manual/en/domdocument.loadhtml.php
If you use this method to lookup a domain and the domain doesn’t exist, you’ll get the string
No match for domain. Look for this in the response using strposIf the domain exists, you can filter the response to include the info about registrar, etc. It will be the content of the html tag
<pre>of the response:Also, check out this related question: Who provides a WHOIS API?