PHP code example of gotapi / ip4dev

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

    

gotapi / ip4dev example snippets



$ip4dev = new \Gotapi\Ip4dev\Ip4Dev();
print_r($ip4dev->ipInfo("183.136.216.35"));
print_r($ip4dev->myIp());

Gotapi\Ip4dev\Ip4DevResponse Object
(
    [ip] => 125.120.106.113
    [continent_code] => AS
    [country] => China
    [latitude] => 30.2994
    [longitude] => 120.1612
    [country_code] => CN
    [country_code3] => CHN
    [tz] => Asia/Shanghai
    [asn] => 4134
    [organization] => Chinanet
    [region] => Zhejiang
    [region_code] => ZJ
    [city] => Hangzhou
)