Click to See Complete Forum and Search --> : detect localhost IP


lting
10-12-2004, 10:34 PM
i have a webserver running at dynamic IP ...

any php codes that can use to auto detect the localhost IP?

Jupac
10-12-2004, 10:38 PM
you need like a DNS

free one @ no-ip (http://no-ip.com)

lting
10-12-2004, 11:35 PM
i know ..
but emm i need to know is there any code that can detect localhost ip?

$_SERVER['REMOTE_ADDR']
i think this one can detect remote host ip

but i need to know local host ip

any php codes that can generate?

i use
$_SERVER['SERVER_ADDR']
but it comes out with 127.0.0.1

ShrineDesigns
10-12-2004, 11:58 PM
127.0.0.1 is the actual ip address of your computer looking at itself

to find out your ip on windows (if your behind a network, it will show your network ip address):
Start > Run... > winipcfg

lting
10-13-2004, 01:08 AM
yupp emm is there ay php coding that can help to detect the own computer IP address over the internet?

like if i connect to the internet .. my ip address is 202.105.94.30
so is there any code that can help to detect the ip address besides using server_addr?

yuna
10-13-2004, 07:20 AM
Create a script called info.php with one line:

<?php phpinfo() ?>

Accessing info.php will list all the available globals including $_SERVER globals.

That said, I'm puzzled as to how you have SERVER_ADDR=127.0.0.1. This can only happen if you're connecting from the server to itself. In that case the server would use the localhost interface. If you connected over the Internet to the server, SERVER_ADDR would have to point to a publicly-visible address.

Jupac
10-13-2004, 08:14 PM
something like this


if($_SERVER['SERVER_ADDR'] != "202.105.94.30"
//not 202.105.94.30
}
else{
//is 202.105.94.30
}

andre4s_y
06-10-2007, 10:11 AM
what if i have server with two IP...
One for connecting to the internet,
one for VPN...
i want to detect ip that i get from the vpn..
variable $_SERVER['SERVER_ADDR'] only detect my ip to connet to the internet
is there any technique to detect ip from the vpn?
please help me...
Andre