PHP to C# Exchange Currency Rates -
hi trying exchange rates data below website c# application. if scroll down in below link there developers section , code in php. don't know if can implemented in c# new php.
any on different ways implement or how make php code works in c# application. important use website official euro foreign exchange rates.
http://www.ecb.europa.eu/stats/exchange/eurofxref/html/index.en.html
how can extract data , manage data c# applications
<gesmes:envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns="http://www.ecb.int/vocabulary/2002-08-01/eurofxref"> <gesmes:subject>reference rates</gesmes:subject> <gesmes:sender> <gesmes:name>european central bank</gesmes:name> </gesmes:sender> <cube> <cube time="2016-07-05"> <cube currency="usd" rate="1.1146"/> <cube currency="jpy" rate="113.50"/> </cube> </cube> </gesmes:envelope>
just quick , dirty :
using (var webclient = new webclient()) { var xml = webclient.downloadstring("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"); var xmldoc = new xmldocument(); xmldoc.loadxml(xml); foreach (xmlelement child in xmldoc.documentelement.childnodes[2].childnodes[0]) { var currency = child.attributes[0].innertext; var rate = child.attributes[1].innertext; console.writeline("1€={0} {1}", rate, currency); } }
Comments
Post a Comment