florianv / exchanger

:office: Currency exchange rates framework for PHP

Home Page:https://florianv.github.io/exchanger/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bank of Romania

valentinceaprazaru opened this issue · comments

I get an error when calling "getLatestExchangeRate" function on the NationalBankOfRomania.php Service

The error code is :

vendor\florianv\exchanger\src\Service\NationalBankOfRomania.php:81:string 'https://www.bnr.ro/nbrfxrates.xml' (length=33)
"<html><head><title>Request Rejected</title></head><body>The requested URL was rejected. Please consult with your administrator.<br><br>Your support ID is: <18234980862496801035><br><br><a href='javascript:history.back();'>[Go Back]</body></html>"

How can I alter it to make it work again?

I was able to solve this by adding a header as :

        $content = $this->request(self::URL, [
            'User-Agent' => '',
        ]);

In the "getLatestExchangeRate" function of NationalBankOfRomania class.

@valentinceaprazaru Can you please send a PR to fix the error?
Thanks 👍