I wrote a GeoIP service.
it will get the ip of the user hitting the page or you can attach ip= to the query string.
get vars to pass are:
no format query modifiers will give you the following:
ip address matched to| loc id| country| state| city| zip | longitude | latitude
Formatting the Results:
format= xml,json,bar
Only the elements you want:
f=flags
Flags
- i = ip
- d = locid
- c = country
- s = state
- l = city (this is L for locality)
- z = zip
- n = longitude
- a = latitude
so if the query string had &f=naz you would get back longitude, latitude , and the zip code
Some Examples:
This would get the zip, lng, lat for the IP 8.8.8.8 in json format:
path/index.php?format=json&f=naz&ip=8.8.8.8
This would get the zip ,lng, lat of the person hitting the web server in json format:
path/index.php?format=json&f=naz
This would get the city, state of the person hitting the web server in bar format ( city|state):
path/index.php?format=bar&f=ls