1. PHP: Getting outside IP address
- Posted by Kat <darkvincentdude at yahoo.com> Nov 29, 2005
- 515 views
- Last edited Nov 30, 2005
Occasionally people have asked how to get an their externally accessable ip# when they are behind a router, or when they have a dynamic ip#. This has been working well for me for a while now, and i run it on several http hosts with no problems. It's php, not Eu. <? echo getenv("REMOTE_ADDR"); ?> Use your favorite method to http to this file.php on your remote shell, it returns your ip# that everyone sees you as, you use it. Simple. Kat <[ This message has been forwarded by Vincent on behalf of Kat. ]>
2. Re: PHP: Getting outside IP address
- Posted by akusaya at gmx.net Nov 30, 2005
- 490 views
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. ]>