Get Country currency code by user IP address in php

$ip=$_SERVER[‘REMOTE_ADDR’];
$countrycode = “http://www.geoplugin.net/json.gp?ip=$ip”;
$ip_data = @json_decode(file_get_contents(“http://www.geoplugin.net/json.gp?ip=”.$ip));

if($ip_data && $ip_data->geoplugin_countryName != null){
$result[‘geoplugin_countryName’] = $ip_data->geoplugin_countryName;
$result[‘geoplugin_currencyCode’] = $ip_data->geoplugin_currencyCode;
}

echo $result[‘geoplugin_currencyCode’];