I've been looking around SO and found that, by using $_SERVER['REMOTE_ADDR']
, you can get the client's IP address.
The problem is, if the client is using a Proxy, that value most likely won't be the client's real IP address.
Some people have suggested using both $_SERVER['REMOTE_ADDR']
and $_SERVER['HTTP_X_FORWARDED_FOR']
, like in the accepted answer to this question: How to get the client IP address in PHP?
But the thing is, like most of the comments say, $_SERVER['HTTP_X_FORWARDED_FOR']
is very unreliable and can be easily edited by anyone.
So, what I want to know is, What is the best way to get the client's real IP address?
PS: I don't see how this question is a duplicate; In this question, I'm asking for ways beyond $_SERVER['REMOTE_ADDR']
and $_SERVER['HTTP_X_FORWARDED_FOR']
, which were the answers to that similar question. I've also explained that the answer for that question is insufficient, as shown in the 4th Paragraph.