PHP code example of fernleafsystems / apiwrappers-geoip

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

    

fernleafsystems / apiwrappers-geoip example snippets


	use FernleafSystems\ApiWrappers\GeoIP\Redirectli;

	$oConn = new Redirectli\Connection();
	$oIpCountry = ( new Redirectli\Geo\Lookup() )
			->setConnection( $oConn )
			->me();

	use FernleafSystems\ApiWrappers\GeoIP\GeoJS;

	$oConn = new GeoJS\Connection();
	$oIpCountry = ( new GeoJS\Country\Lookup() )
			->setConnection( $oConn )
			->me();

	use FernleafSystems\ApiWrappers\GeoIP\GeoJS;

	$oConn = new GeoJS\Connection();
	$oIpCountry = ( new GeoJS\Geo\Lookup() )
			->setConnection( $oConn )
			->ips( [ '1.1.1.1', '8.8.8.8' ] );

	use FernleafSystems\ApiWrappers\GeoIP\IPStack;

	$oConn = new IPStack\Connection();
	$oConn->api_key = 'your_ipstack_api_key';
    
    /** @var IPStack\IP\GeoIpVO $oIp */
	$oIP = ( new IPStack\IP\Lookup() )
			->setConnection( $oConn )
			->ip( '123.123.123.123' );