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

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

P: n/a
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.

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Daniel Pope <da*******@shaw.ca> wrote:
_SERVER[REMOTE_ADDR].
I need to track for my client, the vistors IP addresses
There are many reasons _not_ to track ip addrs, you might be running
into one of them.
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.


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_for' or 'client_ip').

--

Daniel Tryba

Jul 17 '05 #2

P: n/a
"Daniel Pope" <da*******@shaw.ca> wrote in message news:<8Vmfc.122074$Ig.70434@pd7tw2no>...
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.


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
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.