What is the most accurate way to get user\'s IP address in 2017 via PHP?
I\'ve read a lot of SO questions and answers about it, but most of answers are old and comme
Short answer:
$ip = $_SERVER['REMOTE_ADDR'];
As of 2019 $_SERVER['REMOTE_ADDR']; is the only reliable way to get users ip address, but it can show erroneous results if behind a proxy server. All other solutions imply security risks or can be easily faked.
$_SERVER['REMOTE_ADDR'];