Copyright (c) 2005, Gary White. See the file gpl.txt for details.
Please report any bugs at http://apptools.com/contact.php
|currencyexchange_class.php||The currencyExchange class file|
|gpl.txt||The General Public License|
|sample.php||A sample of how to use the class|
Extract the files from this archive. The only file necessary for functionality is the currencyexchange_class.php file.
None is required.
See the sample.php file included in the .zip file.
|Date||String||Read only||The date the conversion rates were posted by ECB in YYYY-MM-DD format.|
|Error||String||Read only||Description of last error encountered.|
|Source||String||Read only||Will be either "Local" or "Remote" depending on whether the data was obtained from the cached local copy or the remote XML file.|
|Supplier||String||Read only||If data is successfully obtained, this should be European Central Bank.|
|localFile||String||Read/write||The name and optionally a site root relative path to where the local cached copy of the remote XML file is to be stored.|
|url||String||Read only||The URL to the remote XML file at the European Central Bank web site.|
Note that some properties are marked as read only. PHP does not have the capacity to actually make properties read only. The read only notation above is informational only. Attempting to assign a value to one of the read only properties will generate no error, however, after assigning a value to one of those properties will lead to unpredictable results.
|getData||None||Integer||Gets the data from the cached local file if available, or from the remote ECB file if newer. Returns the number of exchange rates in the XML file.|
|Convert||$from, $to, $amount||Float||Converts $amount from $from currency to $to currency and returns the result. The $from and $to parameters are the three letter identiers that represent the desired currencies.|
|setBaseCurrency||$currency||Boolean||The original rates in the XML file are based on conversion of other currencies to one Euro. You can change this to base the conversion on one unit of any of the other supported currencies. Note that this would only be useful if you are outputting a table of currency conversion rates.|
The most recent version of the currencyExchange class is available at http://apptools.com/phptools/xml/currency/