I have a user registration system on my site. I am using xml ip api of ip-api.com to detect the location of users. My problem is that the php script I am using returns proxy or wrong ip address of users ,and that is why I they can not set correct location in their profile.
I use the following conditional statement to get ip address :
   $ip=$_SERVER["REMOTE_ADDR"];
 if(empty($ip))
 {$ip=
$_SERVER["HTTP_X_FORWARDED_FOR"];}
It returns wrong ip address for some users.
Is there any other way to get real ip or geolocation in php?
 
     
    