Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Currency conversion 1

Status
Not open for further replies.

SPYDERIX

Technical User
Joined
Jan 11, 2002
Messages
1,899
Location
CA
Hi,

I'm looking to do currency conversion from CAD to USD on the fly but need to get the daily conversion rate. I know of one site that has the rate on it:

The newest rate is added at the bottom. I either need to find a better site that shows this rate or I need to extract that rate from my posted url and then store it in my database. How do I go about grabbing that page and then seperating the value into a variable that I can use?

Thanks!

NATE


mainframe.gif


Got a question? Search G O O G L E for links to the fastest answers: www.google.com
 
The Federal Reserve Bank of New York provides exchange-rate data in XML form at this page:


where this part of the URL:

2004%2D01%2D14%2000%3A00%3A00

is a URL-encoded date-time stamp, which, as posted, reads decoded as 2004-01-15 00:00:00.

Construct the correct date-time string, open the URL as a file, and start reading the contents.

Look for the line that contains the string "Canada". The next line of the XML will look something like:

<Value InUsd=&quot;false&quot;>1.299</Value>

Strip off the <Value...>...</Value> tags and there's your exchange rate.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top