IP address question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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  


Re: IP address question

Marcus wrote:
Quoted text here. Click to load it

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.


Re: IP address question

On Mon, 19 Jun 2006 14:23:13 -0500, Marcus wrote:

Quoted text here. Click to load it

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:

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.

Re: IP address question

Marcus wrote:

Quoted text here. Click to load it

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:


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

Un ordenador no es un televisor ni un microondas, es una herramienta

Site Timeline