From 37051a55b01731abf5415b72282a722677864381 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 16 Jun 2024 17:28:21 +0200 Subject: [PATCH] Fix check --- run.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/run.php b/run.php index 307a9a5..bd5d9da 100644 --- a/run.php +++ b/run.php @@ -69,14 +69,13 @@ $url = sprintf('http://api.apilayer.com/exchangerates_data/latest?base=%s&symbols=%s', $from, join(',',$currencies)); $json = download($log, $url, $accessKey); - if(!array_key_exists('quotes', $json)) { + if(!array_key_exists('rates', $json)) { $log->error('No quotes found in JSON response.'); $log->error(json_encode($json, JSON_PRETTY_PRINT)); exit(1); } - foreach ($json['quotes'] as $to => $rate) { - $to = substr($to,3); + foreach ($json['rates'] as $to => $rate) { if ($from !== $to) { $log->debug(sprintf('Found a rate for %s to %s: %f', $from, $to, $rate)); $final[$date][$from][$to] = $rate;