通过网络服务验证当前域名扩展
我正在尝试构建一个表单来验证我输入系统的本地公司的电子邮件地址和公司网站地址。
它收集/验证域名扩展 - .com、.org、.edu、.uk 等。
鉴于域名扩展随着时间的推移而不断添加,我如何才能使其保持最新状态?
我们距离 .com/.net/.org 还很远,因此如果能够进一步实现自动化,那就太棒了。
我使用的技术是Ruby on Rails,但这个总体思想适用于JSP、Cold Fusion、ASP和其他带有表单和验证的技术。
两个不错的选择是:
- 填充列表的有效扩展名列表(或数组)(此时)。基本选项只是有效扩展的列表。高级选项可能允许获取带有扩展名的描述。
- 一项服务,对于给定的字符串,如果它是当前有效的域名扩展,则给出是/否或真/假。
请注意,这与通过电子邮件或域名验证满足的需求不同,这是针对域名扩展名。
I am trying to build a form that validates email addresses and also company web site addresses for local companies that I am entering into the system.
It collects/validates the domain name extension - .com, .org, .edu, .uk, etc.
How can I keep it up to date given that domain extensions are being added over time?
We're a long way from just .com/.net/.org so it would be awesome to automate this more.
The technology I use is ruby on rails, but this general idea is applicable to JSP, Cold Fusion, ASP and other technologies with forms and validations.
Two great options would be:
- A list (or array) of valid extensions (at that moment) that populates a list. The basic option is simply a list of valid extensions. An advanced option might allow for getting descriptions with the extensions.
- A service that will, for a given string, give a yes/no or true/false for if it's a currently valid domain extension.
Please note this is NOT the same need as met by email or domain name validation, this is for domain name extensions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 IANA 的 whois 服务来验证 TLD。他们似乎没有专门的服务,但您可以使用以下方式查询:
http://www.iana.org/cgi-bin/whois?q=com
虽然之后你还必须进行一些解析,但 html 非常简单。
You can use IANA's whois service to validate TLDs. They don't seem to have a dedicated service for it but you can query it using:
http://www.iana.org/cgi-bin/whois?q=com
You'll have to do some parsing after too though but the html is quite simple.