Using IP tracking to serve up ads
Posted 15 August 2006 - 11:18 AM
I've got a site where I'd like to serve up ads based on the user's geographic location.
I'll use $ip = $_SERVER['REMOTE_ADDR']; to detect the IP but how then do I use it, e.g. is there a database of IP to country mappings so I can extract the location and do the necessary?
Any help would be greatly apprciated.
p.s. Nice new look to the forum.
Posted 15 August 2006 - 11:45 AM
Posted 15 August 2006 - 12:01 PM
Also note, for getting an IP address, evan behind a proxy use
$ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
Posted 15 August 2006 - 01:43 PM
I had a quick look at the free country db available from http://www.maxmind.c...p/geoip_country with a tutorial on how to get it going here - http://www.delau.net/php/geoip.html
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users