Getting the visitor's country with hostip.info (www.hostip.info), PHP and an IP address
Results from
Usually, this information is more complete and more accurate than the previous one (UNITED STATES).
Country:
City:
Service closed or php function file () sometimes disabled by the provider since Dec 1, 2008
The results provided by hostip.info are generally displayed in the page "How to detect the visitor's country".
Code with your IP (3.128.94.171) :
$no_ip=getenv("REMOTE_ADDR"); /*$no_ip="3.128.94.171";*/
$hostip= "http://api.hostip.info/get_html.php?ip=$no_ip"."&position=true";
$result = file($hostip);
/*
In the array $result, we will find:
$result[0] :
$result[1] :
$result[2] :
$result[3] :
$result[4] :
*/
// The results provided by hostip.info are generally displayed in the page "How to detect the visitor's country".
Also online, other methods to guess the country.