While doing it, I also noticed that I'm getting paid ads from Google Adsense instead of the default "Gulf Hurricane Relief" that most probably don't give you any earnings when someone click on it. Since then I managed to earn my first USD$100!
Here the code I found at drupal.org:
<-?-php //remove the two "-" to run the script
// make a valid request to the hostip.info API
if ($_SERVER['HTTP_X_FORWARD_FOR']) {
$ip = $_SERVER['HTTP_X_FORWARD_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$url = "http://api.hostip.info/country.php?ip=".$ip;
// fetch with curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$country = curl_exec($ch);
curl_close ($ch);
// display according geotarget
if ($country == "US") { // show Yahoo!
$block = module_invoke('block', 'block', 'view', 4);
print $block['content'];
} else { // show AdBrite
$block = module_invoke('block', 'block', 'view', 1);
print $block['content'];
}
?>


