If you ever go to http://www.hostip.info/, you will find a Community Geotarget IP Project. The great thing about it is that it is free to use. :)

Now, this is just a snippet of code to begin working in the world of GeoIPs. There's a lot more info to be gotten, and if you go to http://www.hostip.info/use.html, you will find many different ways of calling the information that you need.

Just my 2ยข. Thought I'd share.

<?php

$ip = getenv('REMOTE_ADDR');
$url = "http://api.hostip.info/get_html.php?".$ip;

$contents = file_get_contents($url);
$values = split("[\n|\r]",$contents);

foreach($values as $vals) {
	$myvalues = split(": ",$vals);
	$line = "<strong>".$myvalues[0].":</strong> ".$myvalues[1]."<br />";
	echo $line;
}

?>

geotargeting hadn't crossed my mind, cheers
makes for a nice IP logging system ;)
however split() has been deprecated as of 5.3.0, best to use preg_split()

thanks again

Thanks for the heads up on split(). 5.3.0 had only been out for 8 months or so and old habits are hard to break. :)

this does not work for Indian based ips, check here