The get request returns JSON like this where the data I want to access is in a map inside of the second 'data' variable where the keys are times and the values are temperatures, e.g. "2017-01-01 08:11:00: 4.8,".
{
type: "Weather",
name: "ISHIREMO2",
data: {
Temperature: {
data: {...},
I am using
$json = file_get_contents(/*api get request here*/);
after this im trying to access this data using
foreach($json->data->Temperature->data as $key => $val) {
/*manipulating the data here*/
}
but when I run it i get
Warning: Invalid argument supplied for foreach()
also, when trying this with different arrays returned similar to Temperature but with a space in between, such as Wind Speed it also throws an error.