PHP code example of mallka / easygeo

1. Go to this page and download the library: Download mallka/easygeo library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mallka / easygeo example snippets



use mallka\easygeo\Geo;
\mallka\easygeo\Geo::update('Your key','/path/to/your_db_floder');



use mallka\easygeo\Geo;
$res = \mallka\easygeo\Geo::getInfo('113.110.215.242','./store/GeoLite2-City.mmdb','./store/GeoLite2-ASN.mmdb',$lang='zh-CN');
$res = json_encode($res);

/**
$res will display as bellow:
{
    "city":"深圳市",
    "continent":"亚洲",
    "country":"中国",
    "registered_country":"中国",
    "province":"广东",
    "country_code":"CN",
    "province_code":"GD",
    "location"":{
        "accuracy_radius":5,
        "latitude":22.5333,
        "longitude":114.1333,
        "time_zone":"Asia/Shanghai"
    },
    "autonomous_system_number""":"AS4134",
    "organization"":"ASChinanet"
}
**/