以编程方式确定 Web 域是否可用的最有效方法?

发布于 2024-07-06 06:45:55 字数 379 浏览 7 评论 0原文

我正在编写一些代码来确定网络域是否已注册。 例如,我想检查“Google123.com”是否可用。 至少有两种方法可以以编程方式执行此操作,但我不确定哪种方法更有效:

  • A)在 linux/cygwin 中,我可以启动 whois 命令查看域名是否为 正在使用。
  • B) 在 linux/windows 中,我可以 启动 nslookup 命令来查看是否 域是可解析的。

我的问题是:

  1. nslookup 真的是检查注册的有效方法吗? 每个注册的域都有一个名称服务器并显示在 DNS 中吗?
  2. 进行此注册检查的最快方法是什么? 有什么技巧或其他方法可以做到吗?

I am writing some code to determine whether a network domain is registered. For example, I want to check if "Google123.com" is available. There are at least two ways I can do this programmatically, but I'm not sure which is more valid:

  • A) In linux/cygwin, I can launch the
    whois command to see if a domain is
    in use.
  • B) In linux/windows, i can
    launch nslookup command to see if a
    domain is resolvable.

My questions are:

  1. Is nslookup really a valid way to check for registration? Does every registered domain have a name server and show up in DNS?
  2. What is the fastest way to make this registration check? Any tips or other ways to do it?

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

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

发布评论

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

评论(6

悲念泪 2024-07-13 06:45:55

关于#1,没有。 不要求注册域实际上具有 DNS。

In regards to #1, no. There is no requirement that registered domains actually have DNS.

仙气飘飘 2024-07-13 06:45:55

nslookup 会命中系统设置中的 dns 服务器。 它可能落后于时代或者没有任何 dns 条目。 我认为最好的方法是建立一个到 whois.internic.net 端口 43(whois 端口)的 tcp 连接,传递您想要检查的名称,然后您应该会得到一个响应让您知道。 如果不存在,您将收到类似 No match for "domainyourchecking.com" 的响应

nslookup hits your dns server that's in your system settings. It can be behind the times or not have any dns entry. I would think the best way would be to have a tcp connection to whois.internic.net port 43 (the whois port), pass the name you want to check, and then you should get a response letting you know. If it doesn't exist, you'll get a response like No match for "domainyourchecking.com"

木有鱼丸 2024-07-13 06:45:55

有传言称,一些允许您搜索域名的网站实际上是域名投机者的幌子,他们会在您搜索域名后立即购买该域名,然后尝试为您出售。 我从未遇到过这样的骗局,但在搜索您梦想的域名之前,您可能想在新网站上尝试一些垃圾域名搜索。

There are rumours that some of the web sites out there that allow you to search for domains are actually fronts for domain speculators who will buy up the domain as soon as you search for it, and then try to sell it for you. I've never encountered such a scam, but you might want to try a few garbage domain searches on a new site before searching for your dream domain name.

可爱暴击 2024-07-13 06:45:55

whois 的问题在于不同顶级域名 (TLD) 没有一致的响应。

因此,如果您只是寻找 .com 或其他特定的顶级域名,那就没问题。 如果您开始查看各种 ccTld 或其他 gTld,您可能会在逻辑中发现大量特殊大小写,试图找出 whois 命令返回的数据中“可用”的含义。

Whois 始终会向 shell 返回成功信息,即使域可用。 :(

The problem with whois is that there is no consistent response from different tld's.

So if you are only looking for .com or some other specific tld, you're fine. If you start looking at the various ccTlds or other gTlds you may find a lot of special casing in your logic trying to figure out what "available" means in the data returned by the whois command.

Whois always returns success to the shell, even when the domain is available. :(

生寂 2024-07-13 06:45:55

这会给你一个快速的是/否,但如果你认为它是免费的,并且你想要它,请尝试注册它,你可能会发现它已经被占用了。

This will give you a quick yes/no, but if you think it is free, and you want it, try to register it, you may find it is already taken.

奢欲 2024-07-13 06:45:55

系统(“whois $域名”);

system("whois $domainname");

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