Ejemplo 1: cómo obtener la dirección IP del cliente usando php
The simplest way to collect the Client/Visitor IP address using PHP is the REMOTE_ADDR.
Pass the 'REMOTE_ADDR' in PHP $_SERVER variable. It will return the IP address of the visitor who is currently viewing the webpage.
Get the IP address of the website
<?php
echo 'User IP Address : '. $_SERVER['REMOTE_ADDR'];
?>
/*
I Hope it will help you.
Namaste
Stay Home Stay Safe
*/
Ejemplo 2: php get user ip
$ip = $_SERVER['REMOTE_ADDR'];
Ejemplo 3: php get client ip
$_SERVER['REMOTE_ADDR']
Ejemplo 4: php obtiene la dirección IP
$clientIPAddress=$_SERVER['REMOTE_ADDR'];
Ejemplo 5: cómo obtener una dirección ipv4 en php
// Function to get the user IP address
function getUserIP() {
$ipaddress = '';
if (isset($_SERVER['HTTP_CLIENT_IP']))
$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
else if(isset($_SERVER['HTTP_X_FORWARDED']))
$ipaddress = $_SERVER['HTTP_X_FORWARDED'];
else if(isset($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']))
$ipaddress = $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'];
else if(isset($_SERVER['HTTP_FORWARDED_FOR']))
$ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
else if(isset($_SERVER['HTTP_FORWARDED']))
$ipaddress = $_SERVER['HTTP_FORWARDED'];
else if(isset($_SERVER['REMOTE_ADDR']))
$ipaddress = $_SERVER['REMOTE_ADDR'];
else
$ipaddress = 'UNKNOWN';
return $ipaddress;
}
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)