vendredi 28 août 2020

Getting IP address of client using PHP [duplicate]

I was trying to get client's IP using laravel's request()->ip() but it's giving me Google Cloud's i.e. my server's IP. How am I able to get client's IP and how to try it locally?

I am trying $ips = $_SERVER['HTTP_CLIENT_IP'] ? : ($_SERVER['HTTP_X_FORWARDED_FOR'] ? : $_SERVER['REMOTE_ADDR']);. As to test on locally it's giving me 127.0.0.1 How will I able to test on local that it's giving me my client's IP.




Aucun commentaire:

Enregistrer un commentaire