Answers for "In PHP How can we get the IP address of the client?"

PHP
6

php get client ip

$_SERVER['REMOTE_ADDR']
Posted by: Guest on July-11-2020
0

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'];
}
Posted by: Guest on October-16-2020

Code answers related to "In PHP How can we get the IP address of the client?"

Browse Popular Code Answers by Language