HOWTO: Use the Whois DLL Component

Overview

WhoisDLL is a Whois COM object that makes querying domain names a lot easier. The whois server is automatically found (whois servers aren't hard coded in) by WhoisDLL, and the lookup is then executed using this.

Methods/Properties

Methods

whoisdll.whois(domain)
Returns the lookup information for the domain, specified by 'domain'. If there was an error during lookup, this method returns a blank string, and the error is available in the Error property.

whoisdll.nl2br(str)
Takes a string, specified by 'str' and converts all newlines (Ascii character 10) to "<BR>".

whoisdll.nl2CrLf(str)
Takes a string, specified by 'str' and converts all newlines (Ascii character 10) to Ascii character 10 and 13, a carriage return in Windows.

Properties

whoisdll.WhoisServer
If you set this property before calling the 'whois' method, then the server specified will be used. Otherwise, this property contains the server used to perform the whois.

whoisdll.Error
If any error occured during a lookup, this property will hold a description of what the error was.

Example

Server.ScriptTimeout = 30
DomainName = Trim(Request("DomainName"))
DomainName = Replace(DomainName,"
http://","",vbTextCompare)
DomainName = Replace(DomainName,"
www.","",vbTextCompare)
Set whoisdll = Server.CreateObject("WhoisDLL.Whois")
Result = ""
Result = whoisdll.whois(Trim(DomainName))
StartPos = InStr(Result,"Whois Server:")
If StartPos > 0 Then
  StartPos = StartPos + Len("Whois Server:")
  EndPos = InStr(StartPos,Result,vblf)
  WhoisServer = Trim(Mid(Result,StartPos,EndPos-StartPos))
  Set whoisdll = Server.CreateObject("WhoisDLL.Whois")
  whoisdll.WhoisServer = WhoisServer
  Result = ""
  Result = whoisdll.whois(Trim(DomainName))
  WhoisResult = Result
Else
  If InStr(1,Result,"No match for",vbTextCompare) > 0 Then Response.Write "DOMAIN AVAILABLE"
End If 

NOTE: If you know the specific Who Is server address you wish to use, you can set the WhoIsServer property before the search is run. This has the advantage of being faster as a whois lookup doesn't need to be made first.

  • 2551 Users Found This Useful
Was this answer helpful?

Related Articles

HOWTO: Send a mail using CDONTS

<%'declare variables for the mail object (oMail) and the email body (strEmailBody) Dim oMail,...

HOWTO: Send a mail using CDOSYS

 <%  'Dimension variables  Dim objCDOSYSCon     'Create the e-mail server object  Set...