Skip to content

Instantly share code, notes, and snippets.

@ishan-marikar
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ishan-marikar/5ae1d874bf71117f9e02 to your computer and use it in GitHub Desktop.
Save ishan-marikar/5ae1d874bf71117f9e02 to your computer and use it in GitHub Desktop.
var request = require('request');
function geoIP(host) {
var ip = host.match("[0-9]+(?:\.[0-9]+){3}");
var result, url = "http://ip-api.com/json/" + ip[0];
request(url, function(error, response, body) {
return JSON.parse(body);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment