PHP code example of arraypress / wp-ipinfo

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

    

arraypress / wp-ipinfo example snippets


use ArrayPress\IPInfo\Client;

$client = new Client( $api_key );
$info   = $client->get_ip_info( $order->ip );

if ( ! is_wp_error( $info ) ) {
	printf(
		'%s, %s',
		esc_html( $info->get_city() ),
		esc_html( $info->get_country_name() )
	);
}

$country = $client->get_field( $order->ip, 'country' );