Inconsistent IP address extracted with PHP - Give me a hint, please!

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

    Inconsistent IP address extracted with PHP - Give me a hint, please!

    Dear All,

    I'm not new in PHP at all but it's the first time when I used the variable
    _SERVER[REMOTE_ADDR].
    I need to track for my client, the vistors IP addresses but I got stuck with
    this
    problem:
    I have a cable access at home so I have dedicated ( fixed IP address) and I
    tried to record on my server side php script my IP address from home, but I
    got always 2 distinct IP addresses: one is x.y.z.204 when I type directly
    the PHP script URL from the server into my browser and the second one is
    x.y.z.236 when I used a booked link (from my browseer favorites) to the same
    PHP URL on the server and also when I use a http link from any html document
    towards the same above mentioned PHP URL on the server.
    So, I get reported 2 IP addresses of my home computer when I try to record
    on a php side script my home computer IP address always the same in the
    above mentioned circomstances.
    I've tried it for almost 2 days with the same results.
    Any hints would be greatly appreciated.

    Daniel P.



  • Daniel Tryba

    #2
    Re: Inconsistent IP address extracted with PHP - Give me a hint, please!

    Daniel Pope <daniel-po@shaw.ca> wrote:[color=blue]
    > _SERVER[REMOTE_ADDR].
    > I need to track for my client, the vistors IP addresses[/color]

    There are many reasons _not_ to track ip addrs, you might be running
    into one of them.
    [color=blue]
    > problem:[/color]
    [color=blue]
    > I have a cable access at home so I have dedicated ( fixed IP address)
    > and I tried to record on my server side php script my IP address from
    > home, but I got always 2 distinct IP addresses: one is x.y.z.204 when
    > I type directly the PHP script URL from the server into my browser
    > and the second one is x.y.z.236 when I used a booked link (from my
    > browseer favorites) to the same PHP URL on the server and also when I
    > use a http link from any html document towards the same above
    > mentioned PHP URL on the server.[/color]

    It's not probable that your problem has somehting to do with PHP.

    You know your fixed ipaddress, is it one of the 2 you mentioned? My
    guess is that you passing thru a (transparent) loadbalancing proxy.
    There are hints in the $_SERVER array (like the keys 'via',
    'x_forwarded_fo r' or 'client_ip').

    --

    Daniel Tryba

    Comment

    • R. Rajesh Jeba Anbiah

      #3
      Re: Inconsistent IP address extracted with PHP - Give me a hint, please!

      "Daniel Pope" <daniel-po@shaw.ca> wrote in message news:<8Vmfc.122 074$Ig.70434@pd 7tw2no>...[color=blue]
      > Dear All,
      >
      > I'm not new in PHP at all but it's the first time when I used the variable
      > _SERVER[REMOTE_ADDR].
      > I need to track for my client, the vistors IP addresses but I got stuck with
      > this
      > problem:
      > I have a cable access at home so I have dedicated ( fixed IP address) and I
      > tried to record on my server side php script my IP address from home, but I
      > got always 2 distinct IP addresses: one is x.y.z.204 when I type directly
      > the PHP script URL from the server into my browser and the second one is
      > x.y.z.236 when I used a booked link (from my browseer favorites) to the same
      > PHP URL on the server and also when I use a http link from any html document
      > towards the same above mentioned PHP URL on the server.
      > So, I get reported 2 IP addresses of my home computer when I try to record
      > on a php side script my home computer IP address always the same in the
      > above mentioned circomstances.
      > I've tried it for almost 2 days with the same results.
      > Any hints would be greatly appreciated.[/color]

      You may need i2c_realip() available at
      <http://in.php.net/source.php?url=/include/ip-to-country.inc>

      --
      http://www.sendmetoindia.com - Send Me to India!
      Email: rrjanbiah-at-Y!com

      Comment

      Working...