如何检查域名是否存在?

时间:2022-12-04 08:06:26

Not only easy ones like .com or .net, but also, .co.uk, .fr, .gov.rw ... ?

不仅像.com或.net那样简单,还有.co.uk,.fr,.gov.rw ......?

Should I really make a huge mapping "tld to relevant whois server", or is there an easier way ?

我应该真的做一个巨大的映射“tld到相关的whois服务器”,还是有一个更简单的方法?

5 个解决方案

#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?

http://whois.net/有什么好处?

#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 ?

您想知道域名是否已注册,或者DNS是否实际存在于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.

如果前者,然后是基于whois的方法是唯一可行的方法,那么即使这样,你也会遇到大量问题,解析来自各种TLD whois服务器的高度变化的输出。

If the latter, a simple DNS lookup will suffice.

如果是后者,简单的DNS查找就足够了。

#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/

这个似乎比标准的Whois更有效:http://whois.domaintools.com/

Works for .co.uk and .fr as well as the standard ones

适用于.co.uk和.fr以及标准版

#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?

http://whois.net/有什么好处?

#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 ?

您想知道域名是否已注册,或者DNS是否实际存在于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.

如果前者,然后是基于whois的方法是唯一可行的方法,那么即使这样,你也会遇到大量问题,解析来自各种TLD whois服务器的高度变化的输出。

If the latter, a simple DNS lookup will suffice.

如果是后者,简单的DNS查找就足够了。

#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/

这个似乎比标准的Whois更有效:http://whois.domaintools.com/

Works for .co.uk and .fr as well as the standard ones

适用于.co.uk和.fr以及标准版