I get some json data as follows:
$data = json_decode(file_get_contents("$api/$features$key$query"));
print_r2($data);
which gets me the following:
stdClass Object
(
[location] => stdClass Object
(
[name] => Boston, Logan International Airport
[region] =>
[country] => United States
[lat] => 42.36
[lon] => -71.01
[tz_id] => America/New_York
[localtime_epoch] => 1554320436
[localtime] => 2019-04-03 15:40
)
[current] => stdClass Object
(
[condition] => stdClass Object
(
)
[uv] => 5
)
[forecast] => stdClass Object
(
[forecastday] => Array
(
[0] => stdClass Object
(
[day] => stdClass Object
(
[condition] => stdClass Object
(
)
)
[astro] => stdClass Object
(
)
[hour] => Array
(
[0] => stdClass Object
(
[time] => 2019-04-03 00:00
[temp_f] => 41
[condition] => stdClass Object
(
[text] => Moderate rain
)
[wind_mph] => 9.4
[wind_degree] => 91
[wind_dir] => E
[pressure_in] => 30.7
[precip_mm] => 1
[humidity] => 75
[cloud] => 94
[feelslike_f] => 35.1
[windchill_f] => 35.1
[heatindex_f] => 41
[dewpoint_f] => 33.4
[will_it_rain] => 0
When I try to get the location information I use:
$location = $data['location'];
but this doesn't get me the data, I also tried = $data['location']['name'] but still no data