PHP Script to Find GeoIP info
If you have PHP GeoIP module installed, you can use the following PHP script to find GeoIP info.
1 2 3 4 5 6 7 8 9 |
<?php $ip = $_SERVER['REMOTE_ADDR']; echo '<pre>'; echo "\n\ngeoip_country_code_by_name\n\n"; print_r(geoip_country_code_by_name($ip)); echo "\n\ngeoip_record_by_name \n\n"; print_r(geoip_record_by_name ($ip)); |
Or you can use the following API
1 2 3 4 5 |
<?php $ip = $_SERVER['REMOTE_ADDR']; $ip_info = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip)); print_r($ip_info); |