well i've kinda got somewhere.
What you need to do now is find some way of getting the value from the page,
Code:
<%
Dim Total
Total = 15.99
Dim Vat_Perc
Vat_Perc = 17.5
sub calculate_Vat(sum)
vat = (Total * Vat_Perc) / 100
response.write(replace(FormatCurrency(Total + vat,2),"$","£") & "<BR>")
end sub
function calc_vat(sum)
vat = (Total * Vat_Perc) / 100
calc_vat = replace(replace(FormatCurrency(Total + vat,2),"$","£"),"?","")
end function
Function ConvertBold(strBOLD)
Set oRE = New RegExp
oRE.IgnoreCase = True
oRE.Global = True
oRE.Pattern = "<B>[0-9./]+\</B>"
ConvertBold = "$1"
set ORE = nothing
End Function
sub convert_currency(howmuch, vat)
if vat = 1 then
howmuch = replace(calc_vat(howmuch),"£","")
end if
dim pull_results
set pull_results = server.createobject("Microsoft.XMLHTTP")
pull_results.Open "GET", "http://money.cnn.com/markets/currencies/index.html?howmany=" & howmuch & "&currfrom=" & Request.Form("select") & "&currto=" & Request.Form("select2") & "&calculate=true&btn_calculate.x=45&btn_calculate.y=12", false
pull_results.send
results = pull_results.responseText
results = ConvertBold(results)
response.write results & "<BR>" & howmuch
end sub
if request.querystring("convert") = "yes" then
call convert_currency("15.99",1)
end if
%>
<form name="form1" method="post" action="?convert=yes">
<select style="font-family:verdana;font-size:11px;width:157px;" name="select">
<option value="126274" SELECTED>US Dollar</option>
<option value="127354" >Euro</option>
<option value="126279" >Australian Dollar</option>
<option value="126323" >Brazilian Real</option>
<option value="126268" >British Pound</option>
<option value="126275" >Canadian Dollar</option>
<option value="126349" >Czech Koruna</option>
<option value="126308" >Danish Krone</option>
<option value="126287" >Hong Kong Dollar</option>
<option value="126341" >Hungarian Forint</option>
<option value="126327" >Japanese Yen</option>
<option value="126300" >Mexican Peso</option>
<option value="126282" >New Zealand Dollar</option>
<option value="126312" >Norwegian Kroner</option>
<option value="126268" >UK Pound Sterling</option>
<option value="126289" >Singapore Dollar</option>
<option value="126296" >South African Rand</option>
<option value="126315" >Swedish Krona</option>
<option value="126328" >Swiss Franc</option>
</select>
<select style="font-family:verdana;font-size:11px;width:157px;" name="select2">
<option value="126274" >US Dollar</option>
<option value="127354" selected>Euro</option>
<option value="126279" >Australian Dollar</option>
<option value="126323" >Brazilian Real</option>
<option value="126268" >British Pound</option>
<option value="126275" >Canadian Dollar</option>
<option value="126349" >Czech Koruna</option>
<option value="126308" >Danish Krone</option>
<option value="126287" >Hong Kong Dollar</option>
<option value="126341" >Hungarian Forint</option>
<option value="126327" >Japanese Yen</option>
<option value="126300" >Mexican Peso</option>
<option value="126282" >New Zealand Dollar</option>
<option value="126312" >Norwegian Kroner</option>
<option value="126268" >UK Pound Sterling</option>
<option value="126289" >Singapore Dollar</option>
<option value="126296" >South African Rand</option>
<option value="126315" >Swedish Krona</option>
<option value="126328" >Swiss Franc</option>
</select>
<input type="submit" name="Submit" value="Submit">
</form>
When trying this, it will only get the first number, instead of the whole exchange rate, obviously, once you have the rate, you will need to then times the price by the exchange rate to get the price.
Hope this helps...
Gav
Bookmarks