troubleshooting Question

Class in vbscript

Avatar of mcrmg
mcrmg asked on
ASPVB Script
8 Comments1 Solution353 ViewsLast Modified:
Hi,

I would like to use this code, how can I pass an IP to the function?  thx
<%


class browserLocaleObject

public ip
public countryCode
public countryName
public regionCode
public regionName
public city
public zipPostalCode
public latitude
public longitude
public timeZone
public GMTOffset
public DSTOffset


private sub Class_Initialize
Dim objXMLHTTP
Dim coordinates
Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
 ip = Request.ServerVariables("REMOTE_ADDR")


Response.Write ip
' objXMLHTTP.Open "GET", "http://api.hostip.info/?ip="&ip, False
objXMLHTTP.Open "GET", "http://ipinfodb.com/ip_query.php?ip="&ip, False
objXMLHTTP.Send
Set xmldoc = objXMLHTTP.responseXML
on error resume next
' countryCode = xmldoc.selectSingleNode("HostipLookupResultSet/gml:featureMember/Hostip/gml:name").text
countryCode = xmlDoc.documentElement.selectSingleNode("CountryCode").text
countryName = xmlDoc.documentElement.selectSingleNode("CountryName").text
regionCode = xmlDoc.documentElement.selectSingleNode("RegionCode").text
regionName = xmlDoc.documentElement.selectSingleNode("RegionName").text
city = xmlDoc.documentElement.selectSingleNode("City").text
zipPostalCode = xmlDoc.documentElement.selectSingleNode("ZipPostalCode").text
latitude = xmlDoc.documentElement.selectSingleNode("Latitude").text
longitude = xmlDoc.documentElement.selectSingleNode("Longitude").text
timeZone = xmlDoc.documentElement.selectSingleNode("Timezone").text
GMTOffset = xmlDoc.documentElement.selectSingleNode("Gmtoffset").text
DSTOffset = xmlDoc.documentElement.selectSingleNode("Dstoffset").text
set objXMLHTTP=Nothing
End Sub


Public Sub Spill
Dim out
out = "<table id=""tSpill"">"
out = out & "<colgroup><col id=""cLeft""><col id=""cRight""></colgroup>"
out = out & "<tr><td>IP</td><td>" & ip & "</td></tr>"
out = out & "<tr><td>Country Code</td><td>" & countryCode & "</td></tr>"
out = out & "<tr><td>Country Name</td><td>" & countryName & "</td></tr>"
out = out & "<tr><td>Region Code</td><td>" & regionCode & "</td></tr>"
out = out & "<tr><td>Region Name</td><td>" & regionName & "</td></tr>"
out = out & "<tr><td>City</td><td>" & city & "</td></tr>"
out = out & "<tr><td>ZipPostalCode</td><td>" & zipPostalCode & "</td></tr>"
out = out & "<tr><td>Latitude</td><td>" & latitude & "</td></tr>"
out = out & "<tr><td>Longitude</td><td>" & longitude & "</td></tr>"
out = out & "<tr><td>Timezone</td><td>" & timeZone & "</td></tr>"
out = out & "<tr><td>GMT Offset</td><td>" & GMTOffset & "</td></tr>"
out = out & "<tr><td>DST Offset</td><td>" & DSTOffset & "</td></tr>"
out = out & "</table>"
Response.Write out 
End Sub
End class

Dim browserLocale
Set browserLocale = new browserLocaleObject
%>
ASKER CERTIFIED SOLUTION
strickdd

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros