$ip = $_SERVER['REMOTE_ADDR'] ? : ($_SERVER['HTTP_X_FORWARDED_FOR'] ? : $_SERVER['HTTP_CLIENT_IP']);
References
- http://itman.in/en/how-to-get-client-ip-address-in-php/
- https://stackoverflow.com/questions/3003145/how-to-get-the-client-ip-address-in-php
- https://www.virendrachandak.com/techtalk/getting-real-client-ip-address-in-php-2/