<% dim strResult if Request.ServerVariables("request_method")="POST" THEN dim strQuery '取得需要查詢的域名 strQuery=request("domainname") & "." & request("ext")
dim objSock '創建sock對象 Set objSock=Server.CreateObject("Aspsock.conn") '設置whois服務器為rs.internic.net objSock.RemoteHost="rs.internic.net" '設置whois服務器端口為43 objSock.Port=43 '設置操作的超時為60秒 objSock.TimeOut=60 '打開與remotehost的連接,返回真為成功 if objSock.Open then '發出查詢 WriteLn表示用vbCrlf終結(strQuery & vbCRlf) objSock.WriteLn strQuery '讀取返回值,最大長度為65535 strResult=objSock.ReadBytesAsString(65535) '關閉連接 objSock.Close '打印查詢結果,你可以需要對此作些處理 Response.Write "<b>查詢結果</b><br><textarea rows=10 cols=60>" & strResult & "</textarea>" end if Set objSock=Nothing