<?php
$ip=$_SERVER['REMOTE_ADDR'];
$response=file_get_contents('http://ipinfodb.com/ip_query.php?ip='.$ip);
$country_code=substr($response,strpos($response,'<CountryCode>')+13,2);
echo($country_code);
//echo $response;
?>
Now, if blogger hasn't mangled my code too badly, maybe that will help someone.
Thanks to www.ipinfodb.com