Page 1 of 1

External IP Reading

Posted: Fri Mar 25, 2005 9:51 am
by spacebiscuit
Hi,

Does anyone know of a script to read a clients external IP.

I have used two, one gives my local IP address and the othe is giving the server's internal IP address, although in another location.

Thanks,

Rob.

Posted: Fri Mar 25, 2005 10:04 am
by feyd
$_SERVER['REMOTE_ADDR'] :? :?:

Posted: Fri Mar 25, 2005 11:47 am
by spacebiscuit
I tried that but it gives my internal IP 192.168.0.2 - not my external.

Rob.

Posted: Fri Mar 25, 2005 11:49 am
by feyd
that's because you requested it from inside the network, I'd bet.

Posted: Fri Mar 25, 2005 12:25 pm
by spacebiscuit
The server is not on my network.

Posted: Fri Mar 25, 2005 12:56 pm
by Pyrite

Posted: Fri Mar 25, 2005 1:42 pm
by spacebiscuit
Hi,

Thanks for the reply. When I call this script it gives me the local IP of the server which I know is on a network. I also know that it is running ISS if that helps?

Rob.

Posted: Fri Mar 25, 2005 2:38 pm
by feyd
192.168.* is a nonroutable address. You have to be on the same network to see those kind of addresses..

Posted: Fri Mar 25, 2005 3:44 pm
by spacebiscuit
I am on a completely seperate netowrk to the server, it seems very odd that I am getting the servers local IP address!

When I upload the same script to a different server it works ok,giving my correct extrnal IP.

Confused!

Rob.

Posted: Fri Mar 25, 2005 3:48 pm
by feyd
your first server may be behind a firewall like proxy or similar system. Making requests for remote users on their request. That can explain it.. talk to the host..

Posted: Fri Mar 25, 2005 4:46 pm
by spacebiscuit
Thanks feyd, i'll ask them to look into it.

Rob.