-2

Possible Duplicate:
How to implement exchange rate in PHP?

Im currently making a REST currency converter application for a project. I have made the majority of the program. currently I get my rates from yahoo finance which works fine. I have been asked by my lecturer to include another source for my rates in case the yahoo link goes down (just to be safe).

I have been told that a good way to do it would be to page scrape from the bloomblerg site

view-source:http://www.bloomberg.com/personal-finance/calculators/currency-converter/ line 1729 on has the exchange rates I need. How would I be able get the rate that I needed?

so I could have a function when I input GBP and it got the GBP to USD rate.

thanks for any help!

Community
  • 1
  • 1
Will
  • 3,004
  • 29
  • 43
  • I'm not sure how a page-scrape (something changes on the third party site, you're in trouble) can rate as a good 'back-up' measure? – Nanne Feb 18 '12 at 12:43
  • @Nanne Most of the stuff they want to the project it silly. you should see some off the errors they want me to return. – Will Feb 19 '12 at 00:03

1 Answers1

2

take a look at link

It is a very simple to use HTML Parser. Then for the function you want you could have

function converter($input_value)
{
  if ($input_value == "GBP")
     {
       //Do parse for GBP to USD
     }
  else
     {
       //Do parse for USD to GBP
     }

}
mintuz
  • 735
  • 1
  • 18
  • 40