PHP code example of ipdatainfo / sdk
1. Go to this page and download the library: Download ipdatainfo/sdk 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/ */
ipdatainfo / sdk example snippets
PDataInfo\Client;
$client = new Client(); // free tier; or new Client('YOUR_API_KEY')
$info = $client->lookup('8.8.8.8');
echo "{$info['city']}, {$info['country']} ({$info['asn_org']})\n"; // Mountain View, United States (Google LLC)
new Client(
apiKey: 'YOUR_API_KEY', // sent as X-Api-Key; switches to pro.ipdata.info
baseUrl: 'https://ipdata.info', // optional override
timeout: 10.0, // seconds
);