PHP code example of leewillis77 / open-exchange-rates-api

1. Go to this page and download the library: Download leewillis77/open-exchange-rates-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

leewillis77 / open-exchange-rates-api example snippets


use OpenExchangeRates\Config;
use OpenExchangeRates\Request\ConversionRequest;

onfig);

try {
    $response = $request->convert(100, 'USD', 'GBP');
} catch (\Exception $e) {
    die('Request exception received: '.$e->getMessage());
}
echo "100 USD is " . $response . " GBP\n";