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

IP address question

P: n/a
Hello,

I know I can get a client's IP address with $_SERVER['REMOTE_ADDR'], but
I was wondering if I could use PHP to get any additional information,
such as the client's geographic location (zip code would be preferable),
or even just the zip of the ISP. I have spent a lot of time looking for
a solution, but have only really found links to sites where you can
enter an IP and it will trace the info for you. I need to be able to do
it dynamically so that I can keep stats on where viewers are logging in
from (again, I just need general info, like zip code, I don't need to
pinpoint anybody). I looked at all the PHP vars displayed in phpinfo()
but didn't see anything that I thought I could use. Thanks a lot in
advance.

Marcus
Jun 19 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Marcus wrote:
I know I can get a client's IP address with $_SERVER['REMOTE_ADDR'],
but I was wondering if I could use PHP to get any additional
information, such as the client's geographic location (zip code would
be preferable), or even just the zip of the ISP.


To get the ISP's/domain registrar's address, you need to use "whois"; search
for "php whois" to get some ready to use scripts.

There are also database solutions, like GeoIP, which provide you with the
country (and sometimes additional geographical data) the IP originates from.
JW
Jun 19 '06 #2

P: n/a
On Mon, 19 Jun 2006 14:23:13 -0500, Marcus wrote:
I know I can get a client's IP address with $_SERVER['REMOTE_ADDR']


That's not necessarily the case. In many cases you're getting the IP of
the last proxy server the client went through.

Geolocation by IP Address:
http://www.linuxjournal.com/article/7856

--
The USA Patriot Act is the most unpatriotic act in American history.
Feingold-Obama '08 - Because the Constitution isn't history,
It's the law.

Jun 19 '06 #3

P: n/a
Marcus wrote:
[...] I have spent a lot of time looking for a solution, but have only
really found links to sites where you can enter an IP and it will trace
the info for you.


You might as well trace that information yourself. Just grab a copy of the
information those services use, and check the IP in your server. Please
have a look over here:

http://www.hostip.info/dl/index.html

--
----------------------------------
Iván Sánchez Ortega -i-punto-sanchez--arroba-mirame-punto-net

Un ordenador no es un televisor ni un microondas, es una herramienta
compleja.
Jun 19 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.