BACK TO DIRECTORY

Ip2country

by webvitalii

0.0
(0 ratings)

Get country code or country name:

<?php
$ip2country = ip2country();
echo ' Country code: '.$ip2country->country_code;
echo ' Country name: '.$ip2country->country_name;
// or
$ip2country2 = ip2country('212.113.46.148');
echo ' Country code: '.$ip2country2->country_code;
echo ' Country name: '.$ip2country2->country_name;
?>

Get additional info about the country by country code:

<?php
$ip2country_info = ip2country_info($ip2country->country_code);
echo ' iso_code_2: '.$ip2country_info->iso_code_2;
echo ' iso_code_3: '.$ip2country_info->iso_code_3;
echo ' iso_country: '.$ip2country_info->iso_country;
echo ' country: '.$ip2country_info->country;
echo ' lat: '.$ip2country_info->lat;
echo ' lon: '.$ip2country_info->lon;
// or
$ip2country_info = ip2country_info('us');
echo ' lat: '.$ip2country_info->lat;
echo ' lon: '.$ip2country_info->lon;
?>

Ip2country support page

Useful:

Screenshots

Ip2country table

Ip2country table

Ip2country_info table

Ip2country_info table

Plugin Details

Active Installs
10
Total Downloads
4,482
Version
1.3
Requires WP
3.0
Requires PHP
Tested Up To
5.4.21
Added
2011-07-09
Last Updated
2020-08-09 11:23pm GMT

Ratings

5
0
4
0
3
0
2
0
1
0