PHP code example of malvik-lab / ip-api-client

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

    

malvik-lab / ip-api-client example snippets




uzzleHttp\Client;
use MalvikLab\IpApiClient\IpApiClient;

$ipApiClient = new IpApiClient(new Client());
$ipData = $ipApiClient->get('8.8.8.8');

MalvikLab\IpApiClient\DTO\DataDTO Object
(
    [limit] => MalvikLab\IpApiClient\DTO\LimitDTO Object
        (
            [ttl] => 60
            [rl] => 44
        )

    [ipInfo] => MalvikLab\IpApiClient\DTO\IpInfoDTO Object
        (
            [status] => success
            [country] => United States
            [countryCode] => US
            [region] => VA
            [regionName] => Virginia
            [city] => Ashburn
            [zip] => 20149
            [lat] => 39.03
            [lon] => -77.5
            [timezone] => DateTimeZone Object
                (
                    [timezone_type] => 3
                    [timezone] => America/New_York
                )

            [isp] => Google LLC
            [org] => Google Public DNS
            [as] => AS15169 Google LLC
            [query] => 8.8.8.8
        )

)