User Country and IP adress has to detect using java

Heloo,

My requirement is , we developed one website and it is available in

5 countries like India,Us. So when user entered our website url depending on his country our home page has to be changed .

I written java code to detect user system IP address but how to detect country using that ip address. Is it correct procedure or is there any alternative method.

So Plz some one help me if u have idea regarding this .

I m very thank-ful to u .

Sri

[489 byte] By [vsria] at [2007-11-27 5:11:36]
# 1

Look what's out there on the web, like http://software77.net/cgi-bin/ip-country/geo-ip.pl

Otherwise, using the IP is often pointless. My location is returned as einther UK or US, depending on where in the world I am - France, Switzerland, India, they all show up as UK, because that's where the proxy is. So your application might never work for me.

As for alternates, I can't help oyu because you didn't say what you're doing.

CeciNEstPasUnProgrammeura at 2007-7-12 10:32:02 > top of Java-index,Java Essentials,Java Programming...
# 2

You should, rather, check the preferred language of the browser, rather than trying to figure out where the user is coming from using his IP address.

Using the IP is not reliable, for a number of reasons. One of them, is that in a company, you are not, usually, getting that users IP, as he will have an IP on that company private network (usually 192.168.x.x). You are getting the IP of the company router, and/or proxy host, and this could be (although that may not be all that effecient) half way around the world from where the user is currently sitting.

Edit: Man I'm slow, or simply too long-winded.

masijade.a at 2007-7-12 10:32:02 > top of Java-index,Java Essentials,Java Programming...
# 3

worse, I prefer to see pages in English but my geographical location means that servers that use that as the indication give my Dutch instead.

I know Dutch (being born here it's natural) but that's beside the point (often information presented in a language different from the one it was originally created in looses severely in translation for example).

jwentinga at 2007-7-12 10:32:02 > top of Java-index,Java Essentials,Java Programming...
# 4

I think this is possible.

Please have a look over

http://visualroute.visualware.com/

How this is doing ?

Would like to add more :

You can find the client's IP weather he is directly connected with the internet or behind the proxy then proxy server's IP.

Also the every region has different IP list so from that list you can distinguish in which region this IP resides. For this you have to collect the region wise Static IP List to compare with the client's IP.

jawadhashmia at 2007-7-12 10:32:02 > top of Java-index,Java Essentials,Java Programming...
# 5

Thanks for u r reply.

My total requirement is we developed one online stock tracing website.

It will be available in India,Us,Uk. So i have 3 home pages. depending on user

request i.e. depending on his country that country home page should be loaded. I m from India so if entered that website url it should display our website Indian home page. After that If he want to see another country

home page by selecting the country option he can see that page.

If he is not from those 3 countries then default page should display.

So If u understand my requirement Plz reply me how to change our home page depending on country. Otherwise leave it.

any way Thanks for u.. bye

vsria at 2007-7-12 10:32:02 > top of Java-index,Java Essentials,Java Programming...
# 6

There was the one way which I told you in my previous post. Now you have to implement it.

There could be few other options:

1, While registering the user you must collect the region/country info in db as well as in cookies to the client side. When user hit your default page check for that cookie and redirect the user to that page. If not set in the cookies when user login/sign in with the system then save the country as cookies and redirect to the specific page.

2, Show the option on default page for the user to select its regional site for more information instead of the default site/page.

Now it depends on you which is suitable for you and which fulfill your requirements.

Also wait, might some one else has better idea how to accomplish this.

jawadhashmia at 2007-7-12 10:32:02 > top of Java-index,Java Essentials,Java Programming...