IP address question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marcus

    IP address question

    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
  • Janwillem Borleffs

    #2
    Re: IP address question

    Marcus wrote:[color=blue]
    > 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.[/color]

    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


    Comment

    • Ivan Marsh

      #3
      Re: IP address question

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

      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.

      Comment

      • Iván Sánchez Ortega

        #4
        Re: IP address question

        Marcus wrote:
        [color=blue]
        > [...] 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.[/color]

        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:

        Hostip.info makes its IP search database freely available for all users who want to find their IP addresses or geolocations.


        --
        ----------------------------------
        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.

        Comment

        Working...