PHP code example of rypsx / ipapi

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

    

rypsx / ipapi example snippets



	use Rypsx\Ipapi\Ipapi;

	('208.80.152.201');
	} catch (\Exception $e) {
	    print $e->getMessage();
	}

	var_dump($ipapi);

object(Rypsx\Ipapi\Ipapi)[3]
  public 'erreur' => null
  public 'date' => string '2016-08-07 12:01:16' (length=19)
  public 'ipAdr' => string '208.80.152.201' (length=14)
  public 'ip2long' => int -800024375
  public 'ipapi' => 
    object(Rypsx\Ipapi\IpRequest)[4]
      public 'erreur' => 
        array (size=0)
          empty
      public 'status' => string 'success' (length=7)
      public 'pays' => string 'United States' (length=13)
      public 'paysCode' => string 'US' (length=2)
      public 'region' => string 'California' (length=10)
      public 'ville' => string 'San Francisco' (length=13)
      public 'cp' => string '94105' (length=5)
      public 'latitude' => string '37.7898' (length=7)
      public 'longitude' => string '-122.3942' (length=9)
      public 'timezone' => string 'America/Los_Angeles' (length=19)
      public 'isp' => string 'Wikimedia Foundation' (length=20)