How do you check if a domain name exists?

冷暖自知 提交于 2019-12-03 04:18:14

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';
}

http://whois.net/ any good?

Ashutosh Singh-MVP SharePoint

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";
}

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.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!