By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,377 Members | 1,660 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,377 IT Pros & Developers. It's quick & easy.

ip location lookup

100+
P: 178
Hi,

Can anyone tell me how I can get the users ip address and location? Do the ip addresses fall into different ranges per country or something?
Sep 17 '08 #1
Share this Question
Share on Google+
6 Replies


iam_clint
Expert 100+
P: 1,208
I believe you have to have a database of ip's->Country->State->City
and use ajax to query this database

Related Links
http://www.ip2location.com/?s=google
Sep 17 '08 #2

freddieMaize
P: 85
Hi,

A simple search in google will tell you a lot :). Anyway, as of me, there are ways to find the ip of the client using java and i believe there are also javascript ways of doing it.

And about your next question,
Do the ip addresses fall into different ranges per country or something?
again, as of my knowledge, YES.

fREDDIE
Sep 18 '08 #3

acoder
Expert Mod 15k+
P: 16,027
Not with JavaScript. You could use some Java (with permissions on some browsers) or server-side code.
Sep 18 '08 #4

100+
P: 178
Yeah I think purchasing the db is the way to go. thanks guys was just looking for a cheaper option
Sep 18 '08 #5

P: 93
Hi You can't trace the actual IP of the machine If you are using Internet.
As this comes after masking by router.But anyways you can get that in local intranet perfectly and upto much in internet as
Expand|Select|Wrap|Line Numbers
  1. HttpServletRequest reg = 
  2. (HttpServletRequest)FacesContext.getCurrentInstance).getExternalContext).getRequest();//Instance creation You can create of your own in your manner
  3.        reg.getRemoteUser();
  4.             reg.getRemoteHost();
  5.             reg.getRemotePort();
  6.             reg.getRemoteAddr();
With these all you can have user related information
Sep 19 '08 #6

P: 1
Hi,
I don,t have that much idea about finding the users Ip address ,But if you have some ones IP address you can find the location of the IP address by using the site IP-Details.com. And those locations are not the perfect location of the user because the IP you are providing will some how shows the origin only .
Jun 25 '13 #7

Post your reply

Sign in to post your reply or Sign up for a free account.