How can I detect what country is the visitor from?

Posted by bx510, 09-18-2008, 10:46 PM
I need to detect where the visitor is coming from on my website. I want to show something different on my website depending on what country they are from. I think it's called geo targeting? I want something like this, If the visitor is from USA, then show regular website, else if the visitor is from Canada, then redirect to x.com else if visitor is from another other country, show websites with ads

Posted by markov, 09-18-2008, 11:32 PM
It is what the search engines do ... something yahoo and Google like Yahoo.co.uk ....sg.Yahoo.com ....hk.yahoo.com Are you referring to this?

Posted by bx510, 09-19-2008, 03:36 AM
No, not exactly. I just want a script where I can show different set of codes to different countries. I don't actually have a WHOLE different set of codes, just minor stuff like... ads, news, etc..

Posted by mod_webhosting, 09-19-2008, 06:45 AM
What you need is a database with IP address and location pairs. When a visitor come, you compare his IP address to the addresses contained in the database and if it is a match you act appropriately. Keep in mind that IP databases are not always accurate.

Posted by bager, 09-19-2008, 07:38 AM
Try maxmind geoipfree http://www.maxmind.com/app/geoip_country it is free database of IP to countries

Posted by Codebird, 09-19-2008, 03:40 PM
if bager's link doesn't help, try this: http://webnet77.com/scripts/geo-ip/index.html it is free and it is not just the database it has the php and perl code too. plus they provide you with a script that updates your ips file automatically all u have to is fixing it a bit and running it on a cron job so that it updates everyday or something

Ця відповідь Вам допомогла?

 Роздрукувати цю статтю

Також прочитайте

M2M Host Offers Discount Across All Web Hosting Plan This Christmas!

Posted by livechatdir, 12-17-2009, 08:49 PM M2M Host, the leading web hosting company...

NT vs Linux

Posted by Thebeginner, 09-15-2001, 07:15 AMhi guys can somebody explain me the following:...

Limit concurrent users in MySQL

Posted by ThaiZone, 01-15-2008, 02:49 AMI try to search and not found the solutions to limit...

Does the use of partitions prevent hackers from getting access to the linux server?

Posted by lifeonfire, 05-07-2007, 11:11 AMDoes the use of partitions prevent hackers from getting...

grsec WARNING: No module mptscsi found for kernel 2.6.22.9-grsec, continuing anyway

Posted by uploadalerts, 03-27-2008, 04:46 PMHi, I see the following error, while trying to...