Skip to content

Commit

Permalink
Fix check
Browse files Browse the repository at this point in the history
  • Loading branch information
JC5 committed Jun 16, 2024
1 parent 5ee83cd commit 37051a5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions run.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 37051a5

Please sign in to comment.