Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/topfunky/sinatra-geoip
Simple IP to lat/long API application using the MaxMind GeoLite database.
https://github.com/topfunky/sinatra-geoip
Last synced: 11 days ago
JSON representation
Simple IP to lat/long API application using the MaxMind GeoLite database.
- Host: GitHub
- URL: https://github.com/topfunky/sinatra-geoip
- Owner: topfunky
- Created: 2010-08-12T22:14:16.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2010-08-12T22:16:32.000Z (over 14 years ago)
- Last Synced: 2024-04-15T14:13:25.661Z (7 months ago)
- Language: C
- Homepage:
- Size: 1.07 MB
- Stars: 57
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sinatra GeoIP App
Extremely simple IP to Lat/Long API demo. Use at your own risk.
# Author
Geoffrey Grosenbach http://peepcode.com
# Requirements
* Build ext/GeoIP-1.4.6 (./configure && make && sudo make install)
* Download binary GeoLiteCity.dat database from http://www.maxmind.com/app/geolitecity
* Put GeoLiteCity.dat in "./data"
* Isolate will install other dependencies when you launch the app.# Run
rackup -p 3000 config.ru
# API
View JSON data for an IP address with:
http://localhost:3000/geoip/api/locate.json?ip=24.18.211.123
{
latitude: 47.684700012207
country_name: "United States"
area_code: 206
city: "Seattle"
region: "WA"
longitude: -122.384803771973
postal_code: "98117"
country_code3: "USA"
country_code: "US"
dma_code: 819
}# Legal
This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/.