WebService实例-域名查询~

查询表单:

www.__________ [查询]
域名[www.stefli.com]居然还没有被注册!

接口说明文档:
http://whois.aspsir.com/whois.asmx?wsdl

程序代码:

1<form action="test.asp" method="post" name="form1">
2<table border="0" cellpadding="2" cellspacing="0" width="318">
3<tr>
4<td width="36"><div align="right">www.</div></td>
5<td width="218"><input id="strDomain" maxlength="30" name="strDomain" size="30" type="text" value="stefli.com"/></td>
6<td width="42"><input name="Submit" type="submit" value="查询"/></td>
7</tr>
8</table>
9</form>
 1   
 2strDomain = Request.Form("strDomain")   
 3strUrl = " http://whois.aspsir.com/whois.asmx/Lookup?strDomain =" & strDomain & ""   
 4Set oXmlHttp = Server.CreateObject("Microsoft.XMLHTTP")   
 5oXmlHttp.Open "GET", strUrl, False   
 6oXmlHttp.Send()   
 7If oXmlHttp.readyState <> 4 Then Response.Write Err.Description   
 8strResult = bytes2BSTR(oXmlHttp.responseBody)   
 9If Instr(strResult,"No match")<>0 Then   
10Response.Write "域名[www." & strDomain & "]居然还没有被注册!"   
11Else   
12Response.Write "呵呵,来晚了一步!域名已经被注册~"   
13End If   
14Set oXmlHttp = Nothing 
15
16Function bytes2BSTR(vIn)   
17Dim strReturn   
18Dim I, ThisCharCode, NextCharCode   
19strReturn = ""   
20For I = 1 To LenB(vIn)   
21ThisCharCode = AscB(MidB(vIn, I, 1))   
22If ThisCharCode < &H80 Then   
23strReturn = strReturn & Chr(ThisCharCode)   
24Else   
25NextCharCode = AscB(MidB(vIn, I + 1, 1))   
26strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))   
27I = I + 1   
28End If   
29Next   
30bytes2BSTR = strReturn   
31End Function   
1<br/>
1<br/>

接口说明文档:

1<br/>
1<br/>

http://whois.aspsir.com/whois.asmx?wsdl

Published At
Categories with Web编程
Tagged with
comments powered by Disqus