I'm looking to create a basic IP tracker, I'm trying to figure out how to echo certain aspects of this variable, cheers:
{"ip":"MY IP","country_code":"GB","country_name":"United Kingdom","region_code":"ENG","region_name":"England","city":"MY CITY","zip_code":"MY CODE","time_zone":"Europe/London","latitude":----,"longitude":-----,"metro_code":-}
This is the code which I was reading up on:
$location = file_get_contents('http://freegeoip.net/json/'.$_SERVER['REMOTE_ADDR']);
print_r($location);
{
"ip": "77.99.179.98",
"country_code": "GB",
"country_name": "United Kingdom",
"region_code": "H9",
"region_name": "London, City of",
"city": "London",
"zipcode": "",
"latitude": 51.5142,
"longitude": -0.0931,
"metro_code": "",
"areacode": ""
}
Cheers!