• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can't get my Country name using InetAddressLocator  RSS feed

 
Shajid Johnny
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello dear members,
I am developing a struts application in which i want to get user's country name, currency, language etc by their IP address. For this purpose, I used InetAddressLocator methods in the following way:


I imported all necessary classes/jar. It gives the following output:


your IP address: en_**
your country name:
your language name:
your host name: 0:0:0:0:0:0:0:1


I am living in Bangladesh & I am using a real IP address. But no way it shows the proper info.
I checked my IP http://www.geobytes.com/IpLocator.htm?GetLocation and it displays all the informations including country code, capital, city, timezone, currency, currency code etc.

can anyone please point me the problem?

am I using wrong API? if so, then what might be the proper solution?

Thanks in advance :-)
 
Rob Spoor
Sheriff
Posts: 20903
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try reading http://www.javaranch.com/journal/2008/08/mapping-ip-addresses-to-locations.html
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even better these days is http://www.maxmind.com/app/geoip_country
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!