Created
May 15, 2011 06:14
-
-
Save shripadk/972913 to your computer and use it in GitHub Desktop.
GeoIP 0.4.0beta1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var geoip = require('geoip@0.4.0beta1'); | |
var ip = '50.19.121.109'; | |
var city = new geoip.City('/usr/local/share/GeoIP/GeoLiteCity.dat'); | |
city.lookup(ip, function(data) { | |
console.log(data); | |
}); | |
/** | |
RESULT: | |
{ country_code: 'US', | |
country_code3: 'USA', | |
country_name: 'United States', | |
region: 'WA', | |
postal_code: '98144', | |
latitude: 47.583900451660156, | |
metro_code: 819, | |
dma_code: 819, | |
area_code: 206, | |
continent_code: 'NA' } | |
Missing longitude, city(!!) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment