-2

Possible Duplicate:
IP to Country?
IP To Country in PHP

I have a website where I am storing user's IP address when they visit. I want to server them IP based first page content. I think I can store IP ranges in database and when the users come from those ranges I can serve them specific content.

But the question is just after typing website address the website will load and it will show the default content. Please tell how can I achieve this? So that I can serve country based content to my users.

Suppose if IP address is;

IP Address: 109.97.86.2 

It should detect that it is Romania and it should present pages which is designed for Romania.

Community
  • 1
  • 1
Steeve
  • 423
  • 2
  • 9
  • 23

2 Answers2

3

Use one of the various geoip databases; i think the one from MaxMind is the most popular one.

Then simply perform the ip=>country lookup when a new user goes to your site and display the content for his country.

ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
0

IP to Country databases are often out of date - a better approach might be to put the flags of the various countries your customers come from at the top of the site and let people self-select. This way if Mom in the UK is talking with her son in Japan, they can both see the same site if they wish.

Scott C Wilson
  • 19,102
  • 10
  • 61
  • 83