$user_ip = $_SERVER['REMOTE_ADDR']; echo "Your IP address is: " . $user_ip;
$user_ip = $_SERVER['HTTP_X_FORWARDED_FOR']; echo "Your IP address is: " . $user_ip;Both of these examples use native PHP functions and do not require any external package libraries.