Issues (2)

get-latest-rates-base-only-two-curencies.php (1 issue)

1
<?php
2
3
include 'vendor/autoload.php';
4
5
use GuzzleHttp\Exception\GuzzleException;
6
use Deltatuts\Fixer\FixerHttpClient;
7
use Deltatuts\Fixer\Exception\MissingAPIKeyException;
8
use Deltatuts\Fixer\Exception\InvalidCurrencyCodeException;
9
10
// Put your api key here
11
$key = '';
12
13
try {
14
    $client = new FixerHttpClient($key);
15
} catch (MissingAPIKeyException $e) {
16
    var_dump($e);
17
}
18
19
// Get the supported symbols
20
try {
21
    // Requires a paid plan
22
    $response = $client->rates->latest('EUR', ['MXN', 'USD']);
23
24
    print_r(json_decode($response->getBody()->getContents(), true));
25
} catch (GuzzleException $e) {
26
    var_dump($e);
27
} catch (InvalidCurrencyCodeException $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
28
}
29