Skip to content

wokis/php-json-geoip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-json-geoip

REST API for MaxMind GeoLite2 using PHP and JSON.

The MaxMind PHP reader class can be found at https://github.com/maxmind/MaxMind-DB-Reader-php

The database itself can be found at http://dev.maxmind.com/geoip/geoip2/geolite2/

Online API

Online API access can be found at

http://api.kacper.se/geoip/{ip}

{ip} should be replaced with the actual IP address to geolocate. Any valid IPv4 or IPv6 address will work. RFC 1918 and RFC 3927 addresses will return no match found. If no IP address is given, the connecting host´s IP address will be used.

No match found returns http status code 404.

Invalid IP address returns http status code 400.

Example

http://api.kacper.se/geoip/8.8.8.8
or
http://api.kacper.se/geoip/2001:4860:4860::8888

At this time there is no request limit in place, please don't abuse the service.

Cross Origin Resource Sharing

The API supports Cross Origin Resource Sharing (CORS) for AJAX requests. You can read the CORS W3C working draft, or the enable cross-origin resource sharing website.

Requirements

This code requires PHP 5.4 or greater. Older versions of PHP are not supported.

bcmath is required for the MaxMind reader class.

Dependencies

It's recommended to use Composer to install the required dependencies.

MaxMind DB Reader PHP API

About

REST API for MaxMind GeoLite2 using PHP and JSON

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages