This is http://www.firstpr.com.au/rwi/funds/index.html .
At my Devil Fish page http://www.firstpr.com.au/rwi/dfish/index.html I have some clickable links which cause the browser to load a page from the Commonwealth Bank (my bank) currency conversion system. The URL includes the amount of Australian dollars to be converted, and the currency to be converted to - so the page they see has the up-to-date foreign currency amount for the service they have selected.
Below you will find details of how to construct your own URLs to perform the same functions. Similar principles would apply for converting overseas currencies to AUD$. This documentation is primarily so I know how to do it, but I would be happy if it helps someone else. The following solution is far better than what I used to do, an out-of-date list of conversions.
(It would be possible to write a script for Unix to periodically create an appropriate URL for wget (Search http://www.freshmeat.net for wget.) This would enable a system to methodically and automatically retrieve conversion rates by parsing the resultant HTML page. This could be used to automatically update a price list, which could be merged with an HTML file and automatically uploaded to a server. )
The normal page for Commonwealth Bank currency conversions is:
This is a frame, including the page:
http://www.commbank.com.au/Today/frames_default.htm?s=2&n=2&b=FxCalc&
http://www.commbank.com.au/Today/ForeignExchange/TBC-FxCalc.htmI will concentrate on the top form and button to convert Australian dollars to foriegn currencies.
Take a look at the above file, saved with a .txt extension so you see it as plain text.
tbc-fxcalc.htm.txtThis sets up a form with two items of information entered by the user. Firstly the AUD$ amount to convert and secondly, via a pull-down list, which currency to convert it to. The submit button activates the form and sends the information to the server using the POST method. This is a relatively complex arrangement of the browser contacting the server and then sending the form data in a separate transaction.
Fortunately the Commonwealth Bank server also accepts form data via the simpler (for our purposes) GET method. This is simply a matter having the browser use a suitably formatted URL, which contains all the information.
Here is an example of the magick incantation to convert AUD$1234 to USD$:
http://www.commbank.com.au/scripts/CGI/fxcalc.exe?wdirectory=%5Cfxcalc&where=aussie&aus_amount=1234&convert_cur=USD%3AUS+Dollar
The following text is mandatory. Removing elements of it causes
the server not to respond:
http://www.commbank.com.au/scripts/CGI/fxcalc.exe?wdirectory=%5Cfxcalc&where=aussie&aus_amount=
After that, we have the AUD$ amount to convert. We can use
an integer or two decimal places:
1234or
1234.00or
1234.56are all fine.
Then we need the text:
&convert_cur=USD%3AUS+Dollarfollowed by a three character code for the currency. From the text in the HTML for the <select> pulldown menu, the following country codes are found:
USD:US Dollar GBP:Great British Pound ATS:Austrian Schillings BEF:Belgian Franc CAD:Canadian Dollar CNY:Chinese Renminbi DKK:Danish Kroner EUR:Euro FJD:Fijian Dollar FIM:Finnish Markka FRF:French Franc DEM:German Deutschemarks GRD:Greek Drachmae HKD:Hong Kong Dollar INR:Indian Rupees IDR:Indonesian Rupiah IEP:Irish Pounds ITL:Italian Lire JPY:Japanese Yen KWD:Kuwaiti Dinars MYR:Malaysian Ringgits MTL:Maltese Lira NLG:Netherlands Florins XPF:New C/Tahiti Francs NZD:New Zealand Dollar NOK:Norwegian Kroners OMR:Oman Rials PGK:P.N.G. Kina PKR:Pakistan Rupees PHP:Philippines Pesos PTE:Portuguese Escudo SAR:Saudi Riyals SGD:Singapore Dollars SBD:Solomon Island Dollars ZAR:South African Rand ESP:Spanish Pesetas LKR:Sri Lanka Rupees SEK:Swedish Kronors CHF:Swiss Franc THB:Thai Bahts VUV:Vanuatu VatuNote that the text:
Is based on the line above, from the HTML:&convert_cur=USD%3AUS+Dollar
The ":" is converted to "%3A" and the space after "US" is converted into a "+".USD:US Dollar
The "%3A" is a means of encoding the ":" using its hexadecimal value, 3A, without actually using the character ":" which has special meaning in a URL. Likewise, "+" is a means of encoding a space.
Don't be distracted by the "AUS" in this text! It is the "A" of the 3A followed by US.
The first three characters after the "=" are the ones which tells the server which currency to convert to. It must be one of those listed above.
Following that and the "%3A" is actually almost whatever you like. It is possible to convert to Saudi Riyals but use the text: "Hutt+River+Province+Shekels" you can have the Commonwealth Bank server display this text. Caution is highly advised, since this this is the text which users read, and it seems to be coming from the Bank.
http://www.commbank.com.au/scripts/CGI/fxcalc.exe?wdirectory=%5Cfxcalc&where=aussie&aus_amount=1234.56&convert_cur=SAR%3AHutt+River+Province+ShekelsHere is the above list, converted into the required form with "%3A" and "+", with the "&convert_cur=" added.
&convert_cur=USD%3AUS+Dollar &convert_cur=GBP%3AGreat+British+Pound &convert_cur=ATS%3AAustrian+Schillings &convert_cur=BEF%3ABelgian+Franc &convert_cur=CAD%3ACanadian+Dollar &convert_cur=CNY%3AChinese+Renminbi &convert_cur=DKK%3ADanish+Kroner &convert_cur=EUR%3AEuro &convert_cur=FJD%3AFijian+Dollar &convert_cur=FIM%3AFinnish+Markka &convert_cur=FRF%3AFrench+Franc &convert_cur=DEM%3AGerman+Deutschemarks &convert_cur=GRD%3AGreek+Drachmae &convert_cur=HKD%3AHong+Kong+Dollar &convert_cur=INR%3AIndian+Rupees &convert_cur=IDR%3AIndonesian+Rupiah &convert_cur=IEP%3AIrish+Pounds &convert_cur=ITL%3AItalian+Lire &convert_cur=JPY%3AJapanese+Yen &convert_cur=KWD%3AKuwaiti+Dinars &convert_cur=MYR%3AMalaysian+Ringgits &convert_cur=MTL%3AMaltese+Lira &convert_cur=NLG%3ANetherlands+Florins &convert_cur=XPF%3ANew+C/Tahiti+Francs &convert_cur=NZD%3ANew+Zealand+Dollar &convert_cur=NOK%3ANorwegian+Kroners &convert_cur=OMR%3AOman+Rials &convert_cur=PGK%3AP.N.G.+Kina &convert_cur=PKR%3APakistan+Rupees &convert_cur=PHP%3APhilippines+Pesos &convert_cur=PTE%3APortuguese+Escudo &convert_cur=SAR%3ASaudi+Riyals &convert_cur=SGD%3ASingapore+Dollars &convert_cur=SBD%3ASolomon+Island+Dollars &convert_cur=ZAR%3ASouth+African+Rand &convert_cur=ESP%3ASpanish+Pesetas &convert_cur=LKR%3ASri+Lanka+Rupees &convert_cur=SEK%3ASwedish+Kronors &convert_cur=CHF%3ASwiss+Franc &convert_cur=THB%3AThai+Bahts &convert_cur=VUV%3AVanuatu+Vatu
So, to create your URL, take the text:
Add the value to be converted, for instance:http://www.commbank.com.au/scripts/CGI/fxcalc.exe?wdirectory=%5Cfxcalc&where=aussie&aus_amount=
etc.1000256.78
Then add one of the lines from the list immediately above.
Voila!