PDA

View Full Version : JS currency converter?



NickNameDrive
05-22-2010, 05:35 PM
Is it possible to have JS that will grab currency rates from sites such as this http://uk.finance.yahoo.com/currencies/converter/#from=GBP;to=EUR;amt=1 and using them convert currency on your site without referal to source? And is it legal?

Thanks!

djr33
05-22-2010, 08:10 PM
It's not illegal, but it may be against their terms of service (so it is illegal, or at least a grey area.... I don't know all of the technical details). If you credit them and it doesn't say you can do that in the TOS, then it's probably ok. At the very least, I expect you can find some site out there with the info that DOESN'T say you can't do it, and that's probably ok. But to be really safe, why not just ask them?

As for doing this, you can't do it using just Javascript unless they have some sort of API that is designed for that. Instead, you will need to use a serverside language like PHP (ASP, CGI, JSP, etc) that can load the page to your server, parse it and then return only the relevant info. Then you can use Javascript to display the information as needed (for example with Ajax).


It will not be easy and it may not be legal. It's not impossible though.

Really, I'd suggest just contacting the various services and hoping to get lucky AND looking for one that already has an API. It may require an ad from their site on yours, but that's a small price to pay for a live service. (This isn't just a one-time thing-- you're relying on them to keep the information accurate.)

azoomer
05-22-2010, 08:55 PM
the ecb has a currency rate xml feed that i think can be used freely. You can get it here http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml, You will need a php parser to publish it. If you use wordpress I know of a plug in that uses this feed.

NickNameDrive
05-27-2010, 07:58 PM
the ecb has a currency rate xml feed that i think can be used freely. You can get it here http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml, You will need a php parser to publish it. If you use wordpress I know of a plug in that uses this feed.

From ECB, solid! Will try, post result later.