deltatuts /
fixer-exchange
| 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 | $response = $client->rates->latest(); |
||
| 22 | |||
| 23 | print_r(json_decode($response->getBody()->getContents(), true)); |
||
| 24 | } catch (GuzzleException $e) { |
||
| 25 | var_dump($e); |
||
| 26 | } catch (InvalidCurrencyCodeException $e) { |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
Loading history...
|
|||
| 27 | } |
||
| 28 |