Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: Live Currency Conversion using Google

Results 1 to 3 of 3
Share This Thread →
  1. #1
    jazzy639 is offline Registered User
    Join Date
    Jun 2006
    Posts
    24
    Rep Power
    0

    Live Currency Conversion using Google

    Hey

    I needed to do some currency conversion and it turned out really simple, thought I'd share the function:

    Code:
    Private Function convertcurrency(fromcurrency, tocurrency, amount, decimalplace)
    	url = "http://www.google.com/ig/calculator?hl=en&q=" & amount & fromcurrency & "%3D%3F" & tocurrency
    	set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 
    	xmlhttp.open "GET", url, false 
    	xmlhttp.send "" 
    	output = xmlhttp.responseText 
    	set xmlhttp = nothing 
    		
    	output = Split(output,"""")
    	arrconverted = Split(output(3)," ")
    	convertcurrency = Round(arrconverted(0),decimalplace)
    End Function
    PS this forum seems to be adding a space to "decimalplace"
    Last edited by Shadow Wizard; May 26th, 2010 at 10:21 AM.

  2. #2
    Shadow Wizard's Avatar
    Shadow Wizard is offline Moderator From Beyond
    Join Date
    Sep 2004
    Location
    Israel
    Posts
    31,126
    Rep Power
    2921
    Quote Originally Posted by jazzy639
    PS this forum seems to be adding a space to "decimalplace"
    indeed, that's part of the "break long words" mechanism of the
    forums that prevent horizontal scroll bar.. I fixed that by
    spacing the parameters of the function.

    thanks for sharing!

  3. #3
    Joggi is offline Registered User
    Join Date
    Oct 2011
    Posts
    1
    Rep Power
    0

    Error

    I'm recieving an error when using this code.
    anyone tell me where i'm going wrong?

    Error:
    msxml3.dll (0x80072EFE)
    The connection with the server was terminated abnormally
    /test/cur.asp, line 11

    Code:
    Code:
    <html>
    <head>
    </head>
    <body>
    <%
    Private Function convertcurrency(fromcurrency, tocurrency, amount, decimalplace)
    	url = "http://www.google.com/ig/calculator?hl=en&q=" & amount & "+" & fromcurrency & "+in+" & tocurrency
    
    	set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 
    	xmlhttp.open "GET", url, false
    	xmlhttp.send "" 
    
    
    	output = xmlhttp.responseText 
    
    
    	set xmlhttp = nothing 
    		
    	output = Split(output,"""")
    	arrconverted = Split(output(3)," ")
    	convertcurrency = Round(arrconverted(0),decimalplace)
    End Function
    
    response.write(convertcurrency("USD","GBP",1,2))
    %>
    </body>
    </html>

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

Similar Threads

  1. Excel currency conversion help?
    By sk01 in forum Visual Basic Programming
    Replies: 0
    Last Post: August 16th, 2006, 04:21 PM
  2. Excel currency conversion macro!?!?!?
    By sk01 in forum Programming Help
    Replies: 0
    Last Post: August 16th, 2006, 04:18 PM
  3. Google offers live traffic maps on cell phones (Reuters)
    By RSS_News_User in forum Technology News
    Replies: 0
    Last Post: July 25th, 2006, 11:05 AM
  4. Google offers live traffic maps on cell phones (Reuters)
    By RSS_News_User in forum Technology News
    Replies: 0
    Last Post: July 25th, 2006, 06:03 AM
  5. conversion of Currency (Number) into Words in ASP
    By Steve Schofield in forum ASP Development
    Replies: 0
    Last Post: March 8th, 2002, 01:13 AM

ASP Free Advertisers and Affiliates