What alternatives exist for capturing client IP addresses in PHP when faced with limitations from hosting providers?

Many hosting providers restrict access to the client's IP address due to security and privacy concerns. In such cases, an alternative method to capture the client's IP address in PHP is by using the `$_SERVER['HTTP_X_FORWARDED_FOR']` header. This header contains the client's IP address when the request is made through a proxy server.

if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $client_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
    $client_ip = $_SERVER['REMOTE_ADDR'];
}

echo "Client IP Address: " . $client_ip;