PHP code example of draguo / ip

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

    

draguo / ip example snippets


$config = [
    'driver' => 'amap'
    'key' => 'qweqweqwassdf',
];
    
// return array
$service = new Ip($config);
$location = $service->toLocation($ip); 
[
    country
    province
    city
    adcode // 城市的编号
    lng // 经度
    lat // 维度
    isp // 服务商
]