Hello i use this api: http://ipapi.co/json to get country, city and real ip address in localhost (127.0.0.1) work perfect, but when i put my code to my website my code not show address of the client, but address of the server how can i fix this ?
I can get client ip address with $_SERVER['REMOTE_ADDR']; but i need this api to get country and city with: http://ipapi.co/json.
Function TTT() {
    $ip = false;
    $city = false;
    $region = false;
    $country = false;
    $country_code = false;
    if($json = @file_get_contents("http://www.geoplugin.net/json.gp")) {
      $obj = json_decode($json);
      if(isset($obj->geoplugin_request) && $obj->geoplugin_request != false) {
        $ip = "IP: ". $obj->geoplugin_request. "</br>";
      }
      if(isset($obj->geoplugin_city) && $obj->geoplugin_city != false) {
        $city = "City: ". $obj->geoplugin_city. "</br>";
      }
      if(isset($obj->geoplugin_city) && $obj->geoplugin_city != false) {
        $region = "Region: ". $obj->geoplugin_city. "</br>";
      }
      if(isset($obj->geoplugin_countryName) && $obj->geoplugin_countryName != false) {
        $country = "Country: ". $obj->geoplugin_countryName. "</br>";
      }
      if(isset($obj->geoplugin_countryCode) && $obj->geoplugin_countryCode != false) {
        $country_code = "Country Code: ". $obj->geoplugin_countryCode. "</br>";
      }
      return $ip. $city. $region. $country. $country_code;
    }
}
echo TTT();
 
     
    