O metoda rapida de extragere a cursului valutar zilnic de pe BNR.ro
Clasa este de tip Singleton si are 3 metode statice disponibile:
BNR::Curs ( MONEDA ) – returneaza cursul pentru moneda dorita
BNR::Data () – returneaza data feed-ului
BNR::All () – returneaza toate monedele

class BNR
{
	protected $xmlDocument;
	protected $date;
	protected $currency;
	protected static $instance = null;

	protected function __construct ()
	{
		$this->xmlDocument = file_get_contents("http://www.bnr.ro/nbrfxrates.xml");
		$xml = new SimpleXMLElement($this->xmlDocument);
		$this->date = $xml->Header->PublishingDate;
		foreach($xml->Body->Cube->Rate as $line) {
			$this->currency[ strtoupper($line["currency"]) ] = floatval($line);
		}
	}
	
	public static function Instance(){
		if(self::$instance == null) {
			self::$instance = new BNR();
		}
		return self::$instance;
	}

	protected function getCurs($currency = "EUR") {
		$currency = strtoupper($currency);
		return isset($this->currency[ $currency ]) ? $this->currency[ $currency ] : false;
	}

	public static function Curs ($currency = "EUR"){
		return self::Instance()->getCurs($currency);
	}
	
	public static function All ($currency = "EUR"){
		return self::Instance()->currency;
	}
	
	public static function Data(){
		return self::Instance()->date;
	}
}

Exemplu de utilizare

echo BNR::Curs("USD");
echo print_r(BNR::All(),true);
echo BNR::Data();