User Tools

Site Tools


XML Currency Class

ver 1.0 26 Oct 2008

This class implements support for xml currencies files, usually provided by central banks. It's a general class, who must be extended with particulary classes (e.g. BNR_reader.class), fitting your needs.

There is a sub-class that extends the base class to retrieve currency data specifically from XML files provided by the National Bank of Romania.

abstract class XML_currency


    abstract protected function parse_rate_contents($content, $currency = 'EUR');
    abstract protected function parse_domdoc();
    protected $xmlpath
    protected $allow_url_fopen;
    protected $xml_content;
    protected $domdoc


    public function __construct()
    public function parse_xml()
    protected function get_xml_content()
    protected function DOMconnector()

class BNR_reader extends XML_currency


    inherited ones
    protected $xmlpathl => here the URL for xml file


    inherited ones
    public function parse_rate_contents($content, $currency = 'EUR')
    public function parse_domdoc()


- at least PHP 5.0
- allow_url_fopen = 1 in php.ini OR curl extension installed

Download latest version of XML Currency Class package (1.00) here

Documentation in phpdoc format here

I'm always glad to hear your impressions, requests or bug reports at the indicated email on this site.

php/xmlcurrency.txt · Last modified: 2013/03/16 17:40 (external edit)