(view source code of nswhois.vbs as plain text)
Option Explicit
WScript.Echo NetSolWhoIs( "google.com", 10 )
Function NetSolWhoIs( myDomain, myTimeOut )
' This function uses Network Solutions, Inc.'s WhoIs page to
' retrieve information for .com, .org, and .net (and other)
' domains.
' Note that this function will break as soon as Network
' Solution alters the layout of the WhoIs results page.
'
' Arguments:
' myDomain [string] domain name to be queried,
' e.g. "google.com"
' myTimeOut [integer] time-out in seconds
'
' Returns:
' Formated WhoIs information (multi-line string)
'
' Written by Rob van der Woude
' http://www.robvanderwoude.com
Dim arrLine, arrText, blnTimedOut, i, objIE
' Open the appropriate NetSol WhoIs URL in Internet Explorer
Set objIE = CreateObject( "InternetExplorer.Application" )
objIE.Visible = False
objIE.Navigate2 "https://www.networksolutions.com/whois/" _
& "registry-data.jsp?domain=" & Trim( myDomain )
' Wait till IE is ready
i = 0
blnTimedOut = False
Do While objIE.Busy
WScript.Sleep 100
i = i + 1
' Time out after the specified number of seconds
If i > CInt( myTimeOut * 10 ) Then
blnTimedOut = True
Exit Do
End If
Loop
' Retrieve the URL's text and save it in an array
If Not blnTimedOut Then
arrText = Split( objIE.Document.Body.InnerText, vbLf )
End If
' Close the Internet Explorer session
objIE.Quit
Set objIE = Nothing
' Check if a time-out occurred, and return the result
If blnTimedOut Then
NetSolWhoIs = "-- timed out --"
Else
' Filter out the lines starting with 3 spaces
For i = 0 To UBound( arrText )
If Left( arrText(i), 3 ) = " " Then
arrLine = Split( arrText(i), ":" )
' Add the line to the function's return value
NetSolWhoIs = NetSolWhoIs _
& Left( Trim( arrLine(0) ) _
& String( 20, " " ), 20 ) _
& arrLine(1) & vbCrLf
End If
Next
End If
End Function
page last modified: 2024-04-16; loaded in 0.0050 seconds