WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WinInet
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Make a WHOIS Request


Question:

How to make a WHOIS request? Please, can someone give me an example how to fetch whois data from a given ip or domain name?

There are several whois servers on the net. Is there a complete list of the whois servers?

Is there one the 'best' of all, who knows all the data, or have I loop through all the whois servers until I found the data?

Do the whois server send back a standard common data record format, or have I create an interface for each whois information?

Answer:

Try this. You will need to change some of the vars for file paths and things but it will work.

I don't use it to display pretty results I only use the ouput file to search for my dns servers. You can parse the output file to only display the pretty whois output. It's pretty easy 'cause there's some starting and ending text within the file.

I am not *proud* of this code it's just a tool I threw together to get results! :)

This code was part of a larger code group that I use to automagically test hundreds of domains for secondary and primary dns servers. Hope it helps you get where you want to go!

AddExtender("wsrch34i.dll")
AddExtender("WWINT34i.DLL")

rootPathToProgram = "C:\dscinc\cybermaint\checkSecondaryDNS\"
;DebugTrace(@ON,"%rootPathToProgram%debug.txt")

pathToFile = "%rootPathToProgram%domains_to_check_secondary_dns.ini"
theFilePath = "C:\dscinc\cybermaint\checkSecondaryDNS\"
fileToSearch = "pipe.txt"
writeDomainsDNS = "%rootPathToProgram%add_these_domains_to_ns2_primarydns_com.txt"
writeDomainsWhois = "%rootPathToProgram%\whoisoutput.txt"
whoisOutputFileToSearch = "%rootPathToProgram%whoisOutputFileToSearch.txt"

answer = "1"

While answer == "1"

      GoSub _checkitNow
      GoSub _checkWhois

      answer = AskYesNo ("Again?","Want to check another domain?")

      ;message("name",answer)

EndWhile


Exit




;***************************************************************************
;**
;**  _checkitNow
;**
;** This is the
;***************************************************************************


:_checkitNow

domainToCheck = AskLine("Enter your domain to check", "Enter the domain name", "lookwww.com" )

Return

;##################################
;
;  _checkWhois
;  prints the report detail Lines
;############################################################


:_checkWhois

BoxText("%@CRLF%%@CRLF%Checking this domain: %name%")


domainToWhois = StrCat("http://www.netsol.com/cgi-bin/whois/whois?STRING=",domainToCheck,"&SearchType=do&STRING2.x=17&STRING2.y=8")


tophandle=iBegin(0,"","")
datahandle=IUrlOpen(tophandle,domainToWhois )
xx=iReadData(datahandle,whoisOutputFileToSearch)
iClose(datahandle)
iClose(tophandle)
;Message("All","Done")

z=0
handle=SrchInit(rootPathToProgram,whoisOutputFileToSearch,"NS2.PRIMARYDNS.COM|ns2.primarydns.com|216.219.239.8","",16)

;Message("handle",handle)
While 1
      furryfile=SrchNext(handle)
      If furryfile=="" Then Break
      z=z+1
      ; Message("File Found",furryfile)
      BoxText("%@CRLF%%@CRLF%Inside while loop Checking this domain: %name%")
EndWhile
SrchFree(handle)

If z != "0" Then
      WHOIS=1
      write_report_lines = name
      GoSub _printDetailLinesDNS

EndIf

A=AskFiletext("whois results for: %domainToCheck%", whoisOutputFileToSearch, @UNSORTED, @SINGLE)

Return





Article ID:   W15874
File Created: 2004:03:30:15:41:20
Last Updated: 2004:03:30:15:41:20