网站运营优化

网站设计、开发、策划、运营、优化和推广等

« 50个有用的网站设计资源一个基于WEB的QQ程序 »

使用xmlhttp查询域名是否被注的小程序

  提交查询的页面比较简单如下:
  =====
  <HTML>
  <HEAD>
  <META NAME="GENERATOR" Content="Microsoft Visual Studio 7.0">
  </HEAD>
  <BODY>
  <form method="post" action="return-whois.asp" ID=Form1>
  <input type="text" name="domain" ID=Text1>
  <select name="ext" ID=Select1>
  <option value="com">.com</option>
  <option value="net">.net</option>
  <option value="org">.org</option>
  </select>
  <input type="submit" name="Submit" value="WhoIs" ID=Submit1>
  </form>
  </BODY>
  </HTML>
  ==============
  return-whois.asp
  =======
  <%@ Language=VBScript %>
  <HTML>
  <HEAD>
  <META NAME="GENERATOR" Content="Microsoft Visual Studio 7.0">
  </HEAD>
  <BODY>
  <%
  on error resume next
  Dim Retrieval
  Dim Domain
  Dim TakenHTML
  Function GetURL(url)
  'Response.Write url
  Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
  With Retrieval
  .Open "GET", url, False, "", ""
  .Send
  GetURL = .ResponseText
  End With
  Set Retrieval = Nothing
  End Function
  Domain = Replace(Request.Form("domain"),"www.","") & "." & Request.Form("ext")
  TakenHTML = GetURL("http://www.internic.net/cgi/whois?whois_nic="&Domain&"&type=domain")
  '这里他通过查找error和no match来判断是否出错,或是否被注,这可能是whois那里返回的takenhtml的功劳
  if InStr(TakenHTML,"Error") > 1 then
  'If the page html contains "Error"
  Response.Write Domain & "出错了!<br><br>"
  else
  if InStr(TakenHTML,"No match") > 1 then
  Response.Write Domain&"还没有被注册<br><br>"
  else
  Response.Write Domain&"已经被注册了<br><br>"
  end if
  end if
  %>

  </BODY>
  </HTML>
  =======
  不过在内部网上好想不行,老是"被注册了",大家试试吧!!




发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

<< 2012-1 >>

Sun

Mon

Tue

Wed

Thu

Fri

Sat

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

订阅博客

  • 订阅我的博客:订阅我的博客

站内搜索

热文排行

最新评论及回复

最近发表

本站采用创作共用版权协议, 要求署名、非商业用途和保持一致. 转载本站内容必须也遵循“署名-非商业用途-保持一致”的创作共用协议.

This site is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.