1.0.10 • Published 2 years ago

geoplugin v1.0.10

Weekly downloads
7
License
ISC
Repository
github
Last release
2 years ago

GEOPLUGIN

Features

  • Get geolocation of visitor's browser
  • Get geolocation by IP
  • Supports the Promise API
  • Automatic transforms for JSON data
  • Free geolocation data provided by http://www.geoplugin.net/

Browser Support

ChromeFirefoxSafariOperaEdgeIE
Latest ✔Latest ✔Latest ✔Latest ✔Latest ✔11 ✔

Limitation

This plugin uses both free and premium versions of geoPlugin. Free version comes with a limitation of 120 lookups per minute. Free version doesn't allow to use secure network request over https protocol. To subscribe geoPlugin premium services please refer to their website Premium IP geolocation access

Installing

Using npm:

$ npm install geoplugin

Using yarn:

$ yarn add geoplugin

Example

usage( free version)

import {getGeo, getGeoByIp} from 'geoplugin';

Getting geolocation of user's browser.

import {getGeo} from 'geoplugin';

// Get geolocation of a user's browser.
getGeo()
  .then(response => console.log(response)) // handle success
  .catch(error => console.log(error)) // handle error
  .then(() => {  }); // always executed

Getting geolocation by an ip address.

import {getGeoByIp} from 'geoplugin';

// Get  geolocation by an ip address.
getGeoByIp('xx.xx.xx.xx')
  .then(response => console.log(response)) // handle success
  .catch(error => console.log(error)) // handle error
  .then(() => {  }); // always executed

usage( premium version)

import {getGeoSSL, getGeoByIpSSL} from 'geoplugin';

Getting geolocation of user's browser.

import {getGeoSSL} from 'geoplugin';

// Get geolocation of a user's browser using premium service.
getGeoSSL('licenseKey')
  .then(response => console.log(response)) // handle success
  .catch(error => console.log(error)) // handle error
  .then(() => {  }); // always executed

Getting geolocation by an ip address.

import {getGeoByIpSSL} from 'geoplugin';

// Get  geolocation by an ip address  using premium service.
getGeoByIpSSL('licenseKey','xx.xx.xx.xx')
  .then(response => console.log(response)) // handle success
  .catch(error => console.log(error)) // handle error
  .then(() => {  }); // always executed

Example Response Object

{
  request: '11.222.333.44',
  status: 200,
  delay: '2ms',
  areaCode: '',
  city: 'Manhattan',
  continentCode: 'NA',
  continentName: 'North America',
  countryCode: 'US',
  countryName: 'United States',
  credit: "Some of the returned data includes GeoLite data created by MaxMind, available from <a href='http://www.maxmind.com'>http://www.maxmind.com</a>.",
  currencyCode: 'USD',
  currencyConverter: 1,
  currencySymbol: '$',
  currencySymbol_UTF8: '$',
  dmaCode: '501',
  euVATRate: false,
  inEU: 0,
  locationAccuracyRadius: '1',
  latitude: '12.345',
  longitude: '-67.890',
  region: 'New York',
  regionCode: 'NY',
  regionName: 'New York',
  timezone: 'America/New_York'
}

Promises

geoplugin depends on a native ES6 Promise implementation to be supported. If your environment doesn't support ES6 Promises, you can polyfill.

Credits

geoplugin is a simple wrapper for REST API provided by geoplugin.com. geoPlugin provides a free geolocation API in multiple different programming languages in a single API call. There is no software installation required, no API key and whether your programming language of choice be Javascript, PHP, XML, JSON, ASP, or CSV, geoPlugin has a way to simply and efficiently geo-localize your visitors.

IP Geolocation by geoPlugin

This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com

License

MIT

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.10

2 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago