Hi all, I need a script, that would show ads by country.. If visitor is from USA - it shows one ad, if UK - other etc... Someone know or have it?
Hello. The solution is pretty simple and it just requires two third-party php files: http://www.maxmind.com/app/geoip_country (download the geolite country binary format) http://www.maxmind.com/download/geoip/api/php (download geoip.inc) And the code is simple as well: <?php include("geoip.inc"); $geofile = geoip_open("GeoIP.dat", GEOIP_STANDARD); $country = geoip_country_code_by_addr($geofile, $_SERVER['REMOTE_ADDR']); geoip_close($geofile); switch($country){ case "US":{ $html = "usa ad code here"; }break; case "GB":{ $html = "uk ad code here"; }break; } echo "Ads: $html"; ?> PHP: Tested and it works as of thirty seconds ago. Let me know if you need more help!