I am trying to use one object from the many provided in my json request.
Trying to obtain only the country name from the data that is given.
$location = file_get_contents('http://freegeoip.net/json/'.$_SERVER['REMOTE_ADDR']);
echo $location;
The above code gives me the following string:
{"ip":"x.xx.xx.x","country_code":"FR","country_name":"France","region_code":"A2","region_name":"Bretagne","city":"Brest","zipcode":"","latitude":xxxx,"longitude":xxxx,"metro_code":"","area_code":""}
Any help would be greatly appreciated!