External IP Reading

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

External IP Reading

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

$_SERVER['REMOTE_ADDR'] :? :?:
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Post by spacebiscuit »

I tried that but it gives my internal IP 192.168.0.2 - not my external.

Rob.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

that's because you requested it from inside the network, I'd bet.
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Post by spacebiscuit »

The server is not on my network.
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

192.168.* is a nonroutable address. You have to be on the same network to see those kind of addresses..
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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..
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Post by spacebiscuit »

Thanks feyd, i'll ask them to look into it.

Rob.
Post Reply