Hi I need the following php script to do a currency conversion using a different XML file.
The script needs to be amended to do the following:
1, The php script downloads every 24 hours an xml file from
rss.timegenie.com/foreign_exchange_rates_forex
rss.timegenie.com/forex.xml or rss.timegenie.com/forex2.xml
2, It then stores the xml file data/contents to a mysql database file ie currency and rate.
Any advice would be appreciated.
解决方案
The script from white hat design uses a regular expression to extract the currency and rate.
As pinaki mentioned your best bet is to use a more simpler and flexible solution of loading the xml file and parsing it with the simplexml functions. The examples on php.net should get you going. Practice on the following xml and when you can parse this then you you'll easily be able to tackle the real xml from timegenie.com :
AOA
Angola Kwanza
125.17