ReactPHP HTTP daemon that resolves GEO information on given IP
PHP
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
README.md
SxGeo.php
composer.json
composer.lock
server.php

README.md

sypex-geo-daemon

ReactPHP HTTP daemon that resolves GEO information on given IP

Usage

Tip: This daemon works extremely fast with PHP7!

Get the database file from official SypexGEO site. You need 'Sypex Geo City' database in UTF-8 encoding.

Install composer and run composer install or (php composer.phar install).

Start the daemon:

php server.php --host=0.0.0.0 --port=16001

Make your simple requests. For example this requests http://127.0.0.1:16001/?ip=213.180.204.3 gives the following output(prettified for better look):

{
    "city": {
        "id": 524901,
        "lat": 55.75222,
        "lon": 37.61556,
        "name_ru": "\u041c\u043e\u0441\u043a\u0432\u0430",
        "name_en": "Moscow"
    },
    "region": {
        "id": 524894,
        "name_ru": "\u041c\u043e\u0441\u043a\u0432\u0430",
        "name_en": "Moskva",
        "iso": "RU-MOW"
    },
    "country": {
        "id": 185,
        "iso": "RU",
        "lat": 60,
        "lon": 100,
        "name_ru": "\u0420\u043e\u0441\u0441\u0438\u044f",
        "name_en": "Russia"
    },
    "time": "0.000406980515",
    "error": false
}

Ping / Status monitoring

You can ping the daemon for html response http://0.0.0.0:16001/?ping=1 and http://0.0.0.0:16001/?ping-json=1 for json response.