Get IP Location Info
With this simple function your able to return information about an ip address. :D
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
Attribute VB_Name = "mLocIP"
'---------------------------------------------------------------------------------------
' Module : mLocIP
' DateTime : 19/12/2009 08:55PM
' Author : Kresha7
' Mail : kresha7@hotmail.com
' Purpose : Gets Information about the location of an IP address
'---------------------------------------------------------------------------------------
Public Function LocateIP(IPAddr As String) As String
Dim HTTP As Object
Dim StrRes As String
Dim IP As String, Region As String, Country As String, City As String, Latitude As String, Longitude As String, TZone As String, ISP As String, ConT As String
Const URL = "http://www.ip2location.com/"
Set HTTP = CreateObject("Winhttp.Winhttprequest.5.1")
With HTTP
.Open "POST", URL & IPAddr
.Send
StrRes = .ResponseText
End With
IP = Mid(Split(Split(StrRes, "dgLookup__ctl2_lblICountry")(1), "</span>")(0), 3)
Region = Mid(Split(Split(StrRes, "dgLookup__ctl2_lblIRegion")(1), "</span>")(0), 3)
Country = Mid(Split(Split(StrRes, "dgLookup__ctl2_lblICity")(1), "</span>")(0), 3)
Latitude = Mid(Split(Split(StrRes, "dgLookup__ctl2_lblILatitude")(1), "</span>")(0), 3)
Longitude = Mid(Split(Split(StrRes, "dgLookup__ctl2_lblILongitude")(1), "</span>")(0), 3)
TZone = Mid(Split(Split(StrRes, "dgLookup__ctl2_lblITimeZone")(1), "</span>")(0), 3)
ConT = Mid(Split(Split(StrRes, "dgLookup__ctl2_lblINetSpeed")(1), "</span>")(0), 3)
ISP = Mid(Split(Split(StrRes, "dgLookup__ctl2_lblIISP")(1), "</span>")(0), 3)
LocateIP = IP & vbNewLine & Region & vbNewLine & Country & vbNewLine & Latitude & vbNewLine & Longitude & vbNewLine & TZone & vbNewLine & ConT & vbNewLine & ISP
End Function
Original Comments (3)
Recovered from Wayback Machine