1. PHP: Getting outside IP address

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. ]>

new topic     » topic index » view message » categorize

2. Re: PHP: Getting outside IP address

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. ]>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu