Page 1 of 1

Server IP Address

Posted: Wed Oct 18, 2006 8:42 am
by amir
Hello all here's one for you.

I need to get the server_addr global variable. Sounds easy, but here's the kicker, I'm on IIS and as I understand it, this variable is not available. How do I get the IP Address of the server?

Posted: Wed Oct 18, 2006 9:41 am
by Obadiah
i never had to do this...but have you looked here

http://us2.php.net/reserved.variables/

Posted: Wed Oct 18, 2006 1:25 pm
by akimm
like the previous poster alluded to,

Code: Select all

<?php

$SERVER['REMOTE_ADDR'];

##or

getenv("SERVER_NAME");

?>

Posted: Wed Oct 18, 2006 1:27 pm
by feyd
REMOTE_ADDR is the requesting agent's IP address. ;)

SERVER_ADDR is the server's, typically.

Posted: Wed Oct 18, 2006 2:05 pm
by amir
Yes, but as I've noted, that variable is not available in IIS.