Re: PHP: Getting outside IP address
- Posted by akusaya at gmx.net
Nov 30, 2005
And if you want to know your local IP address as well,
use this:
echo $_SERVER[REMOTE_ADDR]; // same as Kat's one
echo $_SERVER[HTTP_X_FORWARDED_FOR]; // local address
K> posted by: Kat <darkvincentdude at yahoo.com>
K> Occasionally people have asked how to get an their externally accessable
K> ip# when they are behind a router, or when they have a dynamic ip#. This
K> has been working well for me for a while now, and i run it on several http
K> hosts with no problems. It's php, not Eu.
K> <?
K> echo getenv("REMOTE_ADDR");
?>>
K> Use your favorite method to http to this file.php on your remote shell, it
K> returns your ip# that everyone sees you as, you use it. Simple.
K> Kat
K> <[ This message has been forwarded by Vincent on behalf of Kat. ]>
|
Not Categorized, Please Help
|
|