BNZ feed
http://www.bnz.co.nz/xml/currencySelect.xml
NZ Customs feed
http://www.customs.govt.nz/news/datafeeds/exchange
Yahoo API
for currency conversion:
http://download.finance.yahoo.com/d/?f=sl1d1t1&s=GBPNZD=X
or
http://download.finance.yahoo.com/d/?f=l1&s=GBPNZD=X
Another example:
CoinMill
//http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s='. $from . $to .'=X';
//http://coinmill.com/rss/NZD_USD.xml
/*
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="http://coinmill.com/rss.xsl"?>
<rss version="2.0">
<channel>
<selflink>http://coinmill.com/rss/NZD_USD.xml</selflink>
<title>Coinmill.com Currency Rates</title>
<link>http://coinmill.com/</link>
<description>Current rates and calculator for currencies</description>
<language>en</language>
<pubDate>Wed, 20 May 2009 00:00:00 EDT</pubDate>
<lastBuildDate>Thu, 21 May 2009 00:10:59 EDT</lastBuildDate>
<item>
<title>New Zealand Dollar and United States Dollar</title>
<link>http://coinmill.com/NZD_USD.html</link>
<description>
<![CDATA[
1.00 NZD = 0.60 USD<br/>
1.00 USD = 1.6 NZD<br/>
<a href="http://coinmill.com/NZD_USD.html">Converter</a> --
<a href="http://coinmill.com/chart/NZD_USD.html">Rate Chart</a>
]]>
</description>
<pubDate>Wed, 20 May 2009 00:00:00 EDT</pubDate>
<guid>Coinmill.com NZD/USD 2009-05-20</guid>
</item>
</channel>
</rss>
*/
XmlDocument RSSXml = new XmlDocument();
RSSXml.Load("http://coinmill.com/rss/"+CurrencyCode1+"_"+CurrencyCode2+".xml");
XmlNodeList RSSNodeList = RSSXml.SelectNodes("rss/channel/item");
foreach (XmlNode RSSNode in RSSNodeList)
{
XmlNode RSSSubNode;
RSSSubNode = RSSNode.SelectSingleNode("description");
string description = RSSSubNode != null ? RSSSubNode.InnerText : "";
int eqposn = description.IndexOf(" = ");
double dollarValue = Convert.ToDouble(description.Substring(eqposn+3,description.IndexOf(" ",eqposn+3)-(eqposn+3)));
currencyamt.Visible=false;
currencyresult.Visible=true;
amountresult.Visible=true;
amountresult.InnerText = ""+(dollarValue * Convert.ToDouble(Beweb.DataBlock.GetRequestValue("amount",Request)));
}
Leave a Comment
Comments