ipwhere
v1.1.4
Published
Node.js Geo IP API framework.
Downloads
2
Readme
JavaScript Geo IP API framework
Node.js Geographic IP lookup framework.
Services Implements:
- IPInfoDB.com lite GEO IP. (Done)
- Hostip.info (Pending)
- LocatorHQ.com (Pending)
Installation
Install with the Node.JS package manager npm:
$ npm install ipwhere
Documentation
This package implements the free open geo IP. No data file required. The accuracy of the lite version is not perfect, but provides decent country, state and city. To use this service, register on their site and store the api key in an enviroment variable.
- Register and request API Key, IPInfoDB.com Site.
- Builds of the enginkizil JQuery.
Example
var ipwhere = require("ipwhere");
var ip = new ipwhere({
// required
apikey: process.env.IFAPIDB_KEY, // "XXXXXXXXXXXXXX"
// optional
timeout: 5000
});
ip.city('213.243.4.20', function(err, data) {
console.log('JSON Result (IPv4)', data);
});
// Options: { format: 'json|xml|raw (defaults to JSON)' }
ip.country('213.243.4.20', { format: 'raw' }, function(err, data) {
console.log('Raw Result (IPv4)', data);
});
// Sample Result
{ statusCode: 'OK',
statusMessage: '',
ipAddress: '213.243.4.20',
countryCode: 'TR',
countryName: 'TURKEY',
regionName: 'ISTANBUL',
cityName: 'ISTANBUL',
zipCode: '-',
latitude: '41.0138',
longitude: '28.9497',
timeZone: '+02:00'
}
LICENSE
MIT license. See the LICENSE file for details.