One of the key aspects of the websites I write is the geo-targetting of information. This is primarily to ensure that adverts and location-specific info is shown to users from the relevant country.
To do this, I use a tool from MaxMind called “GeoIP“. There is a free version and a subscription version, and while the latter has more updates and more detailed information down to State and City level, I find the free version is perfectly adequate for country-specific requests. It’s not 100% accurate in that Internet users near country borders might be using ISP’s and consequently IP addresses from over the border, but it’s probably 95% accurate. Of course it helps if you get the regular IP address updates from Maxmind every now and then, but you can automate a monthly download if you so desire.
Usage is relatively simple. I use PHP and run on Apache webservers, and with that combination it’s easy. One PHP function (which is provided) does the hard work, and you only need to upload 3 files (provided) to your webserver. It’s then just a question of putting in a line of PHP to each page to get the country of your visitor into a variable that you can then use how you see fit.
One thing I would note however is the impact of such a process on SEO. I wouldn’t advise you rewrite a whole page using GeoIP (or any geo tool for that matter) as the search engine bots come in from different countries and there is always an outside chance your site could be flagged as “cloaking” – delivering different content to search engines and users, which isn’t good. However for small things like adverts, small bits of text and produvts or links, it would seem ideal.
If you really want to deliver whole different pages of content, then use GeoIP to get the country and then either do a redirect to a different page on your site set up specifically for that country, or provide an extra snippet of code based on the user’s location that provides a link to another, more relevant page. Or even a seperate website.