Skip to content

DevGroup-ru/sypex-geo-daemon

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

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.

About

ReactPHP HTTP daemon that resolves GEO information on given IP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages