PHP code example of tenfef / ipfind-php

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

    

tenfef / ipfind-php example snippets




use Tenfef\IPFind\IPFind;

$apiKey = "YOUR_API_KEY_HERE"; // get an API key from https://ipfind.co or pass in NULL if you plan on using < 100/day
$ipfind = new IPFind($apiKey);
$result = $ipfind->fetchIPAddress('8.8.8.8');
var_dump($result);

/*
object(stdClass)#2 (14) {
  ["ip_address"]=>
  string(7) "8.8.8.8"
  ["country"]=>
  string(13) "United States"
  ["country_code"]=>
  string(2) "US"
  ["continent"]=>
  string(13) "North America"
  ["continent_code"]=>
  string(2) "NA"
  ["city"]=>
  string(13) "Mountain View"
  ["county"]=>
  string(11) "Santa Clara/
  ["region"]=>
  string(10) "California"
  ["region_code"]=>
  string(2) "CA"
  ["timezone"]=>
  string(3) "PST"
  ["owner"]=>
  string(26) "LEVEL 3 COMMUNICATIONS INC"
  ["longitude"]=>
  float(-122.0865)
  ["latitude"]=>
  float(37.3801)
  ["warning"]=>
  string(131) "You are not using an IP Find API Key. You are limited to 100 requests/day. Register for free at https://ipfind.co for higher limits"
}
*/

bash
$ composer