问题
Not only easy ones like .com or .net, but also, .co.uk, .fr, .gov.rw ... ?
Should I really make a huge mapping "tld to relevant whois server", or is there an easier way ?
回答1:
http://php.net/manual/en/function.checkdnsrr.php
if (checkdnsrr('test.nl', 'A')) // or use ANY or for other see above link
{
echo 'Domain exists';
}
else
{
echo 'Domain does not exist';
}
回答2:
http://whois.net/ any good?
回答3:
PHP:
$URL = "http://www.dotnetindex.com/articles/5261-Article--AJAX-Tips-and-Tricks.asp";
$PARSED_URL = parse_url($URL);
$DOMAIN = $PARSED_URL['host'];
$ip = gethostbyname($DOMAIN);
if($ip===$DOMAIN)
{
echo "Url does not exist";
}
else
{
echo "Url exists";
}
回答4:
Do you want to know if the domain is registered, or if it's actually present in the DNS ?
If the former, then whois based approaches are the only viable way, and even then you'll run into massive issues parsing the highly varied output from the various TLDs whois servers.
If the latter, a simple DNS lookup will suffice.
回答5:
You may have to try different services:
This one seems to work for a lot more than the standard Whois: http://whois.domaintools.com/
Works for .co.uk and .fr as well as the standard ones
来源:https://stackoverflow.com/questions/460816/how-do-you-check-if-a-domain-name-exists