Note that there are some explanatory texts on larger screens.

plurals
  1. POGet currency rate
    text
    copied!<p>What I want to do is, </p> <ul> <li>to get conversion rate from this website (I have choosen xe.com because it supports needed currencies AZN &lt;-> USD)</li> <li>If it's possible for example to send "5 AZN" and get what it equals in USD. URL looks like this: <a href="http://www.xe.com/ucc/convert/?Amount=5&amp;From=AZN&amp;To=USD" rel="nofollow">http://www.xe.com/ucc/convert/?Amount=5&amp;From=AZN&amp;To=USD</a></li> </ul> <p>I grabbed the following snippet from <a href="http://dickchiang.blogspot.com/2010/02/getting-foreign-exchange-currency-with.html" rel="nofollow">a blog</a>:</p> <pre><code>string xeString = String.Format("http://www.xe.com/ucc/convert.cgi?Amount=1&amp;From={0}&amp;To={1}", srcCurrency, dstCurrency); System.Net.WebRequest wreq = System.Net.WebRequest.Create(new Uri(xeString)); System.Net.WebResponse wresp = wreq.GetResponse(); Stream respstr = wresp.GetResponseStream(); int read = respstr.Read(buf, 0, BUFFER_SIZE); result = Encoding.ASCII.GetString(buf, 0, read); </code></pre> <p>Now, this will return something like <code>XE.com: USD to EUR rate: 1.00 USD = 0.716372 EUR</code> </p> <p>The problems are: </p> <ol> <li>I have no idea what the variables <code>buf</code> and <code>BUFFER_SIZE</code> are. </li> <li>How can I get an exact result, for instance send <code>5 AZN</code> and get the result in USD (as double)? <a href="http://www.xe.com/ucc/convert/?Amount=5&amp;From=AZN&amp;To=USD" rel="nofollow">http://www.xe.com/ucc/convert/?Amount=5&amp;From=AZN&amp;To=USD</a></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload