When we are preparing to establish 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 are preparing to use has been registered. At this time, we can visit the NIC site, click the "whois" link and enter the domain name to query, and we can get the results we need.
WHOIS server returns all whois data for queries for .com, .net and .org, including website domain name registrants, management contracts, contact information (phone, email, address), billing contact, technical support and domain name server information, which is very helpful for users to understand the basic situation of a website. In many domain name registrar websites, there are usually whois (domain name query) advanced services, but personal websites do not have the qualifications and data of domain name registrar service providers, so they cannot provide whois service under general conditions.
In fact, using the XMLHTTP protocol, each of us can provide domain name detailed query (WHOIS) services on our personal website. This article introduces how to use ASP combined with xmlhttp programming to achieve this function.
1. Principle:
The principle is very simple. The query of domain names 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 to send it back to the client.
At the same time, we use the xmlHttp protocol to achieve the client web page without refresh effect and make the request to retrieve WHOIS data to the server.
The specific process is: the client proposes a domain name query requirement through xmlhttp->ASP listening page in the WEB server accepts the request and uses xmlhttp to send a search command to the WHOIS server-->WHOIS database to perform the query operation, and returns the result to our own WEB server (html form)-->WEB server receives the content, and immediately transmits the result to the client->The client browser uses vbscript to filter out the excess HTML and selects whois data to display it.
2. Brief description of ASP XmlHttp programming:
1. Client html page:
<script language="vbscript"> strFind2 = instr(1,xmlGet,"</FONT></pre>",1) |
2. Server-side ASP program:
<%dim xmlGet,objXML, objXSL, objFSO,strFile, strFileName, strXSL,strURL stra = "submit=submit&fqdn="&trim(("fqdn")) xmlGet = ' Get the information returned by the domain name server |
In the above process, we can find that the ASP program in our own WEB server actually only plays an intermediate role. In actual applications, this intermediate layer can also be omitted and data can be sent and received directly to the WHOIS database through xmlhttp. However, in this case, the method of eliminating the ASP intermediate layer may be disabled (default) because "accessing data resources through (other) domains" in IE may not be able to execute.
This program runs on IIS5.0 and IE6.0 based on Windows 2000 platform. During 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 to your own web page without refresh. At first glance, it looks a bit like the services provided by a professional domain name registrar service provider website.