Advertisement
Guest User

Untitled

a guest
Jul 4th, 2010
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '---------------------------------------------------------------------------------------
  2. ' Module      : mLocIP
  3. ' DateTime    : 19.12.2009  08:55PM
  4. ' Author      : Kreshnik Hasanaj
  5. ' Mail        : kresha7@hotmail.com
  6. ' Purpose     : Gets Information about the location of an IP address
  7. '---------------------------------------------------------------------------------------
  8. Public Function LocateIP(IPAddr As String) As String
  9.     Dim HTTP   As Object
  10.     Dim StrRes As String
  11.     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
  12.     Const URL = "http://www.ip2location.com/"
  13.  
  14.     Set HTTP = CreateObject("Winhttp.Winhttprequest.5.1")
  15.    
  16.     With HTTP
  17.         .Open "POST", URL & IPAddr
  18.         .Send
  19.         StrRes = .ResponseText
  20.        
  21.     End With
  22.  
  23.     IP = Mid(Split(Split(StrRes, "dgLookup__ctl2_lblICountry")(1), "</span>")(0), 3)
  24.     Region = Mid(Split(Split(StrRes, "dgLookup__ctl2_lblIRegion")(1), "</span>")(0), 3)
  25.     Country = Mid(Split(Split(StrRes, "dgLookup__ctl2_lblICity")(1), "</span>")(0), 3)
  26.     Latitude = Mid(Split(Split(StrRes, "dgLookup__ctl2_lblILatitude")(1), "</span>")(0), 3)
  27.     Longitude = Mid(Split(Split(StrRes, "dgLookup__ctl2_lblILongitude")(1), "</span>")(0), 3)
  28.     TZone = Mid(Split(Split(StrRes, "dgLookup__ctl2_lblITimeZone")(1), "</span>")(0), 3)
  29.     ConT = Mid(Split(Split(StrRes, "dgLookup__ctl2_lblINetSpeed")(1), "</span>")(0), 3)
  30.     ISP = Mid(Split(Split(StrRes, "dgLookup__ctl2_lblIISP")(1), "</span>")(0), 3)
  31.  
  32. LocateIP = IP & vbNewLine & Region & vbNewLine & Country & vbNewLine & Latitude & vbNewLine & Longitude & vbNewLine & TZone & vbNewLine & ConT & vbNewLine & ISP
  33.  
  34. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement