PHP code example of valerian / cnbapi
1. Go to this page and download the library: Download valerian/cnbapi 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/ */
valerian / cnbapi example snippets
$request = new Valerian\CnbApi\CnbRequest();
//Actual data
$response = $request->get();
//Data for selected day
$date = new \DateTime();
$date->modify("last day of previous month");
$response = $request->get($date);
//Get all downloaded currencies
var_dump($response->getCurrencies());
//Bank identification
var_dump($response->getBank());
//ČNB last change date
var_dump($response->getDate());
//ČNB order number
var_dump($response->getOrder());
//Exchange rate for EUR
var_dump($response->getCurrency("EUR")->getRate());