You may wonder how some other websites could not only detect your IP address, but also your country and/or city. This article will debunk that mystery, giving you a simple way to mimic such feature with some little effort.
We will use the earlier IP detection script on conjunction with this. You can also use other IP detection module, feel free to modify the script.
$ipadd = getip(); // You can change this to your IP detection handler, if any.
$lines = file(‘http://api.hostip.info/get_html.php?ip=’ . $ipadd);
foreach ($lines as $line_num => $line)
echo "$line<br />";