


Detailed introduction to using xmlhttp to add domain name query function to the website
When we prepare to build a Web site, we must apply for an Internet domain name from the domain name registration agency. Therefore, we usually want to know whether the domain name we intend to use has been registered. At this time, we can visit the NIC site http:// www.nic.net, click the "whois" link and enter the domain name to be queried, you can get the results we need.
The WHOIS server returns all whois data for queries on the international top-level domain names of .com, .net and .org, including website domain name registrants, management contracts, contact information (telephone, electronic mail) Email, address), billing contact, technical support and domain name server information are very helpful for users to understand the basic situation of a website. Many domain name registrar websites usually have advanced whois (domain name query) services, but personal websites cannot provide whois services under general conditions because they do not have the qualifications and data of domain name registrars.
In fact, using the xmlHTTP protocol, each of us can provide domain name details query (WHOIS) service in our own personal website. This article introduces how to use asp combined with xmlhttp programming to achieve this this function.
1. Principle:
The principle is very simple. Domain name query is mainly based on the WHOIS protocol provided by RFC 954. During the implementation process, we access the WHOIS database server of the NIC site through our own WEB server, query the content we need from the WHOIS database, and then combine it into a web page through ASP and send it back to the client.
At the same time, we use the xmlHttp protocol to achieve no refresh effect on the client web page and to request the server to retrieve WHOIS data.
The specific process is: the client puts forward a domain name query request through xmlhttp --> the ASP listening page in the WEB server accepts the request and uses xmlhttp to send a retrieval command to the WHOIS server --> the WHOIS database performs the query operation and returns The results are given to our own WEB server (html form) --> After the WEB server receives the content, it immediately transmits the results to the client --> The client browser uses vbscript to filter out the excess HTML and select the whois data for display.
2. Brief description of ASP XmlHttp programming:
1. Client html page:
<script language="vbscript"> Sub submit1_onmouseup '当点击“查询”按钮时触发; Dim objXML, objXSL, objfso,strFile, strFileName, strXSL,strURL,TheForm Set TheForm = Document.Wordfind window.status="正在检索数据···" strURL="dns.asp" Set objXML = CreateObject("Microsoft.XMLHTTP") '创建MS的XMLHTTP组件; stra = "submit=submit&fqdn="&TheForm.words.value objXML.Open "post",strURL,false '采用Post提交方式; objXML.setrequestheader "content-length",len(stra) objXML.setrequestheader "content-type","application/x-www-form-urlencoded" objXML.send stra ' 发送信息 xmlGet = objXML.responseText '稍等片刻后,得到服务器端传回来的结果; if instr(1,xmlGet,"This is not a valid .com .net .org .info or .biz domain name",1)<1 and len(trim(xmlGet))>100 then if instr(1,xmlGet,"This domain is available",1)<1 then if instr(1,xmlGet,"Registrant:",1) then strFind1 =instr(1,xmlGet,"Registrant:",1) else strFind1 = instr(1,xmlGet,"<PRe><FONT face=""Verdana, Arial",1)+65 strFind2 = instr(1,xmlGet,"</FONT></pre>",1) strFind4=strFind2-strFind1 sHTML = mid(xmlGet,strFind1,strFind4) TheForm.comments.value="查询结果:"+chr(13)+chr(10)+sHTML window.status="查询结果:该域名已被占用" else TheForm.comments.value="恭喜你,此域名可用!" window.status="查询结果:该域名仍然处于可用状态!" end if else TheForm.comments.value= "无效的国际顶级域名!请输入以(.com .net .org .info or .biz)结尾的国际域名, 例如sun.com" window.status="无效的国际顶级域名!请输入以(.com .net .org .info or .biz)结尾的国际域名, 例如CCTV.com" end if Set objXML = Nothing end sub </script> <html><head><title>XMLHTTP之域名查询篇</title></head> <body bgColor=#cccca3> <form method="post" name=wordfind onsubmit="javascript:return false"> 请输入域名名称:<input type="text" value="cctv.com" name="words" size="69"> <input type="submit" value="查询" id=Submit1 name=Submit1> <TEXTAREA name=comments readonly rows=10 cols=76></TEXTAREA> </form></body></html>
2. Server-side ASP program:
<%dim xmlGet,objXML, objXSL, objFSO,strFile, strFileName, strXSL,strURL xmlGet="" if len(trim(Request.form("fqdn"))) > 1 then strURL="http://www.domainbank.net/whoisresults_gen.cfm?show=1" 'WhoIS服务器的地址 Set objXML = CreateObject("Microsoft.XMLHTTP") '创建MS的XMLHTTP组件 stra = "submit=submit&fqdn="&trim(Request.form("fqdn")) objXML.Open "post",strURL,false objXML.setrequestheader "content-length",len(stra) objXML.setrequestheader "content-type","application/x-www-form-urlencoded" objXML.send stra ' 发送信息到WhoIs数据库服务器; xmlGet = objXML.responseText ' 取得域名服务器返回的信息 Set objXML = Nothing end if response.write xmlGet '返回结果给客户端 %>
In the above process, we can find that the ASP program in our own WEB server actually only plays the role of an intermediate transfer. In actual applications, we can also omit this intermediate layer and use vbscript to directly send WHOIS information through xmlhttp. The database sends and receives data. However, in this case, it may be because "access data resources through (other) domains" in IE is disabled (by default), resulting in insufficient permissions and inability to execute, so the method of omitting the ASP middle layer is not very common.
This program runs successfully on IIS5.0 and IE6.0 based on Windows 2000 platform. In actual use, you can copy the above code to your own web page. After simple page editing, you can add the domain name query function without page refresh to your own web page. At first glance, it really looks a bit like Professional domain name registrar website provides services.
The above is a detailed introduction to using xmlhttp to add domain name query function to the website. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Websites for learning C language: 1. C Language Chinese Website; 2. Rookie Tutorial; 3. C Language Forum; 4. C Language Empire; 5. Script House; 6. Tianji.com; 7. Red and Black Alliance; 8, 51 Self-study network; 9. Likou; 10. C Programming. Detailed introduction: 1. C language Chinese website, which is a website dedicated to providing C language learning materials for beginners. It is rich in content, including basic grammar, pointers, arrays, functions, structures and other modules; 2. Rookie tutorials, This is a comprehensive programming learning website and more.

Do you frequently visit the same website at about the same time every day? This can lead to spending a lot of time with multiple browser tabs open and cluttering the browser while performing daily tasks. Well, how about opening it without having to launch the browser manually? It's very simple and doesn't require you to download any third-party apps, as shown below. How do I set up Task Scheduler to open a website? Press the key, type Task Scheduler in the search box, and then click Open. Windows On the right sidebar, click on the Create Basic Task option. In the Name field, enter the name of the website you want to open and click Next. Next, under Triggers, click Time Frequency and click Next. Select how long you want the event to repeat and click Next. Select enable

In macOS Sonoma and Safari 17, you can turn websites into "web apps," which can sit in your Mac's dock and be accessed like any other app without opening a browser. Read on to learn how it works. Thanks to a new option in Apple's Safari browser, it's now possible to turn any website on the internet you frequently visit into a standalone "web app" that lives in your Mac's dock and is ready for you to access at any time. The web app works with Mission Control and Stage Manager like any app, and can also be opened via Launchpad or SpotlightSearch. How to turn any website into

Sometimes, we want to block certain websites on Microsoft Edge for many reasons, whether it is for parental control, time management, content filtering, or even security concerns. A common motivation is to be more productive and stay focused. By blocking distracting websites, people can create a conducive environment for working or studying, minimizing potential distractions. Finally, content filtering is important to maintaining a safe and respectful online environment. Blocking websites that contain explicit, offensive or objectionable content is particularly important in educational or professional settings where upholding appropriate standards and values is crucial. If you can relate to this situation, this article is for you. Here’s how to block access to the Internet in Edge

By default, most iPhone users use Safari browser on their iPhone. They browse and visit different types of websites on Safari browser. Some iPhone users have reported that they are tired of seeing frequently visited websites on the splash screen after launching Safari on their iPhone. In order to change the appearance of the splash screen, you should edit it. If you wish to remove frequently visited websites from Safari, we are here with some simple steps explaining how to do it easily. How to Delete Frequently Visited Websites from Safari on iPhone Step 1: You should first launch the Safari browser on your iPhone. 2nd

To solve the problem of Python website access speed, use database optimization methods such as indexing and caching. In the process of developing and maintaining Python websites, we often encounter the problem of slow website access speed. In order to improve the response speed of the website, we can use some database optimization methods, such as indexing and caching. This article will introduce how to use these methods to solve Python website access speed problems, and provide corresponding code examples for reference. 1. Use indexes to optimize database queries. Indexes are a fast search structure for data in the database, which can greatly

PHP website: 1. Facebook, one of the largest social media platforms in the world; 2. WordPress, an open source content management system for quickly creating and managing various types of websites; 3. Magento, a powerful e-commerce platform , used to create and manage online stores; 4. Joomla, a popular open source content management system used to build various types of websites; 5. Wikipedia, a free online encyclopedia that provides knowledge and information on various topics; 6. Digg, social news sites and more.

7 Effective Ways to Quickly Solve Go Language Website Access Speed Problems With the rapid development of the Internet, website access speed is crucial to user experience. As a high-performance programming language, Go language is widely used in building high-concurrency network applications. However, in actual development, we may encounter the problem of slow access to Go language websites. This article will introduce 7 effective ways to solve this problem and provide corresponding code examples. Caching is one of the most common and effective ways to improve website access speed.
