Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '---------------------------------------------------------------------------------------
- ' Module : mLocIP
- ' DateTime : 19.12.2009 08:55PM
- ' Author : Kreshnik Hasanaj
- ' 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement