Hi,
I try to access my keys from an external json file. I’ve cached it with :
$apiCache = $kirby->cache('api');
$apiData = $apiCache->get('apiData');
if ($apiData === null) {
$apiData = Remote::get('https://api.apiurl.fr/36/artworks?size=100');
$apiData = json_decode($apiData->content, true);
$apiCache->set('apiData', $apiData->content(), 30);
}
And now I can see all data with dump($apiData);
but as soon as I write
<?php foreach($apiData["results"] as $key=>$value):?>
...
<?php echo $value["_source"]["ua"]["artwork"]["domain"] ?>
...
<?php endforeach ?>
I get the message Illegal string offset 'results'
. I don’t understant how to get access, or how can I write it another way to get results, is there something wrong in my code ?