public function __construct($url = 'http://api.nbp.pl/api/exchangerates/tables/A/2020-04-02') { $this->_url = $url; } $pattern = '/\/tables\/A\/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/'; throw new Exception('Unable to find XML filepath!'); } throw new Exception('Unable to create cache directory!'); } } if (!file_put_contents($filepath, $xml)) { throw new Exception('Unable to save file in cache directory!'); } return $xml;
Niestety zwraca throwa Unable to find XML filepath , ktoś podpowie ? Chodzi o pobranie "2020-04-02" i zapisanie w katalogu na ftp.