WhoIs query with XMLHttp sample

Here's a quick example of how to use the XMLHttp object to perform a WhoIs query. You can then write your own function to strip out the desired content in the page and possibly store it in a database or some other file.

Here's a quick example of how to use the XMLHttp object to perform a WhoIs query. You can then write your own function to strip out the desired content in the page and possibly store it in a database or some other file.
I've added our standard code to prevent ASP page caching for your convenience.

If this doesn't work immediately, they may have changed their querystring values. So, you may have to run the lookup manually to get the right URL.

<%

Response.Buffer = True
Response.AddHeader "cache-control", "private"
Response.AddHeader "pragma", "no-cache"
Response.ExpiresAbsolute = #January 1, 1990 00:00:01#
Response.Expires=0

Function WhoIS(sDomain)

Dim oXMLHttp

on error resume next

Set oXMLHttp=Server.CreateObject("MSXML2.XMLHTTP")

oXMLHttp.open "GET", "http://www.netsol.com/cgi-bin/whois/whois?SearchType=do&STRING=" & Trim(sDomain), false

oXMLHttp.send

if oXMLHttp.status = 200 Then
WhoIS = oXMLHttp.responseText
else
WhoIs = "0"
end if

Set oXMLHttp = Nothing

End Function

response.write WhoIs("eggheadcafe.com")

%>


Submission Date:  9/23/2005 2:52:57 PM
Submitted By:  Robbe Morris
My Home Page:  http://www.robbemorris.com

By Robbe Morris   Popularity  (304 Views)
Picture
Biography - Robbe Morris
Robbe has been a Microsoft MVP in C# since 2004. He is also the co-founder of NullSkull.com which provides .NET articles, book reviews, software reviews, and software download and purchase advice.  Robbe also loves to scuba dive and go deep sea fishing in the Florida Keys or off the coast of Daytona Beach. Microsoft MVP