PHP: Get IP address of Server : $_SERVER['SERVER_ADDR']

By Super Man

how to get Ip address of server in PHP.

$_SERVER['SERVER_ADDR'] Gives you the IP address of server on which the current script is executing.

Thus for printing IP address of server use following code snippet.

<?php echo "Server IP Address is $_SERVER['SERVER_ADDR']" ?>

PHP: Get IP address of Server : $_SERVER['SERVER_ADDR']  (1798 Views)