find external IP and external hostname





4
Date Submitted Sat. Apr. 15th, 2006 12:37 AM
Revision 1 of 1
Syntax Master dannyboy
Tags Hostname | IP | VBSCRIPT
Comments 0 comments
find external IP and external hostname with vbscript

On Error Resume Next
Const conURLSrc = "http://checkip.dyndns.org/"
Set http = createobject("microsoft.xmlhttp")
Set fso = CreateObject("Scripting.FileSystemObject")

http.open "GET",conURLSrc,False
http.send
htmlIP = http.responsetext
Set regEx = new RegExp
regEx.Global = True
Regex.pattern"Current IP Address: ([0-9\.]*)"
result = regEx.Test(htmlIP)
Set Matches = regEx.Execute(htmlIP)
For Each Match in Matches
        extIP = match.subMatches(0)
Next
Regex.pattern"Hostname: ([^\s<]*)"
result = regEx.Test(htmlIP)
Set Matches = regEx.Execute(htmlIP)
extHostname = ""
For each Match in Matches
        extHostname = match.subMatches(0)
Next
 

Comments

There are currently no comments for this snippet.

Voting