PHP code example of jayin / ipgeo

1. Go to this page and download the library: Download jayin/ipgeo 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/ */

    

jayin / ipgeo example snippets


$ipGeo = new IpGeo();
$ipGeo->setConfig([
    'driver' => 'Tencent',
    'drivers' => [
        'Tencent' => [
            [
                'app_key' => '{app_key}',
            ]       
        ],
    ]   
]); 
$ip = '61.140.183.172';
$info = $ipGeo->geo($ip);

// 指定配置
$info = $ipGeo->useDriver('baidu')->geo($ip)