如何检查域名是否存在?

发布于 2024-07-11 19:46:10 字数 111 浏览 6 评论 0原文

不仅是 .com 或 .net 等简单的域名,还有 .co.uk、.fr、.gov.rw ...?

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

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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

来世叙缘 2024-07-18 19:46:10

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://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';
}
扭转时空 2024-07-18 19:46:10

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

太阳男子 2024-07-18 19:46:10

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

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";
}
不必你懂 2024-07-18 19:46:10

您想知道该域是否已注册,或者它是否确实存在于 DNS 中?

如果是前者,那么基于 whois 的方法是唯一可行的方法,即使这样,您在解析各个 TLD whois 服务器的高度不同的输出时也会遇到大量问题。

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

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.

罪#恶を代价 2024-07-18 19:46:10

您可能需要尝试不同的服务:

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

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文