php incomming api source IP address code example
Example 1: php get ip address
$clientIPAddress=$_SERVER['REMOTE_ADDR'];
Example 2: php get user ip address
#to best handle proxies use this:
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}