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
spacebiscuit
Forum Contributor
Posts: 390 Joined: Mon Mar 07, 2005 3:20 pm
Post
by spacebiscuit » Fri Mar 25, 2005 9:51 am
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.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Mar 25, 2005 10:04 am
$_SERVER['REMOTE_ADDR']
spacebiscuit
Forum Contributor
Posts: 390 Joined: Mon Mar 07, 2005 3:20 pm
Post
by spacebiscuit » Fri Mar 25, 2005 11:47 am
I tried that but it gives my internal IP 192.168.0.2 - not my external.
Rob.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Mar 25, 2005 11:49 am
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 » Fri Mar 25, 2005 12:25 pm
The server is not on my network.
Pyrite
Forum Regular
Posts: 769 Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:
Post
by Pyrite » Fri Mar 25, 2005 12:56 pm
spacebiscuit
Forum Contributor
Posts: 390 Joined: Mon Mar 07, 2005 3:20 pm
Post
by spacebiscuit » Fri Mar 25, 2005 1:42 pm
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.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Mar 25, 2005 2:38 pm
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 » Fri Mar 25, 2005 3:44 pm
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.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Mar 25, 2005 3:48 pm
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 » Fri Mar 25, 2005 4:46 pm
Thanks feyd, i'll ask them to look into it.
Rob.