Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: ASP + Domain Checker I need help badly


Message #1 by "hack" <hack_uk@h...> on Mon, 16 Dec 2002 13:59:20
Hi There

I Need Help.. I have downloaded a free asp script to check if a domain 
has been registered or not.. It work fine, but has no error checking 
illegal characters and spaces are allowed could you please tell me how to 
add error checking into this script. 

Thanks In Advance

<% Option Explicit %>
<%

Class Whois

Public domain
Public Root
Private strHTML
Private xml
Private strHTMLbits

public Function Run
    Set xml = Server.CreateObject("Microsoft.XMLHTTP")
    If Right(root,3) = ".uk" then
      xml.Open "GET", "http://195.66.240.196/cgi-bin/whois.cgi?query=" & 
domain & "." & root, False
    Else
      xml.Open "GET", "http://www.internic.com/cgi/whois?
type=domain&whois_nic=" & domain & "." & root, False 
    End if
    xml.Send
    strHTML = xml.responseText
    If (InStr(strHTML,"<pre>") and InStr(strHTML,"</pre>")) OR (InStr
(strHTML,"<PRE>") and InStr(strHTML,"</PRE>")) then
      
      strHTMLbits = Split (strHTML, "<PRE>", -1, 1)
      strHTML = strHTMLbits(1)
      strHTMLbits = Split (strHTML, "</PRE>", -1, 1)
      strHTML = strHTMLbits(0)
      strHTMLbits = Split (strHTML, "</PRE>", -1, 1)
      strHTML = strHTMLbits(0)
      strHTMLbits = characterStrip(strHTML,"</PRE>", -1, 1)
    Else
      strHTML = "   Error:<br><br>The Domain you entered may contain 
invalid characters."
    End If
End Function 

Public Property Get available
    If InStr(strHTML,"No match") or InStr(strHTML,"not found") then
      available = 1
    Elseif InStr(strHTML,"No information") then
      available = 2
    Elseif InStr(strHTML,"Error") then
      available = 3
    Else
      available = 0
    End If
End Property

Public Property Get output
    output = strHTML
End Property

End Class

%>

  Return to Index