[!--quoteo(post=379105:date=Jun 1 2006, 11:02 AM:name=gnuffo1)--][div class=\'quotetop\']QUOTE(gnuffo1 @ Jun 1 2006, 11:02 AM) [snapback]379105[/snapback][/div][div class=\'quotemain\'][!--quotec--] This site [a href=\"http://api.hostip.info/?ip=\" target=\"_blank\"]http://api.hostip.info/?ip=[/a][ip address] produces an xml document giving details about the IP address, including the country. So it would probably be quite easy to write a function that gets the country code from there based on $_SERVER['REMOTE_ADDR'] [/quote] Great, fantastic, that's what I was looking for. And indeed the function is pretty easy... [code]function ipToCountry($ip='') { if ($ip=='') $ip = $_SERVER['REMOTE_ADDR']; $file = fopen (("http://api.hostip.info/?ip=" . $ip), "r"); if (!$file) { echo "<p>Unable to open remote file.\n"; exit; } while (!feof ($file)) { $line = fgets ($file, 1024); if (eregi ("<countryName>(.*)</countryName>", $line, $out)) { $country = $out[1]; return $country; } } fclose($file); }[/code] The function ipToCountry() returns "UNITED KINGDOM" for me here, and ipToCountry('203.26.206.130') returns "AUSTRALIA" (just a random example). Thanks very much. [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]