Bester binare optionen broker 1 euro12 comments
Download forex trading software
Expand your skills with this month's free Premium course. View April's Free Course. I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose.
It turns out that Yahoo! At this point it would be useful to learn about currency codes. That said, if you want to query multiple rates you could enter comma separated values like this: But here our objective is to demonstrate how to read that data using PHP and return it as an array or a standard class objects. Building the PHP Solution Our objective is to develop a solution that would offer the following options: Lookup or query multiple currencies 2.
Output the results as either an associative array or a standard class object. At this point I should explain that each line of data would be returned as an array with numerical keys. So the first step in building the solution is to find a way of exchanging the numerical keys with something more useful. Adding Useful Array Keys To address this issue we will first create a way to change the numeric keys to some useful values.
This helps us crate our associative array later on, and it also makes more sense if we convert the results to a standard class object. This pair of functions would do that very nicely.
We now turn to the function that really puts this solution into gear, and delivers our desired results. Loop through the targets and perform lookup on Yahoo! Those comments should pretty much explain what it does, and how. Just put this function together with the others, stick them into your web project and you have the complete setup to grab those exchange rates.
Now let us look at a typical implementation and the parameters we can pass to our function. The currency code of your choice, and for which you wish to get exchange rates. Add additional target currencies if desired.
This determines whether to output associative array or standard class object. And there you go! I hope you find this useful for your projects, and have fun getting those exchange rates. Here is a somewhat more complete set of currencies Yahoo finance API is not available anymore. I have moved to MarketXLS after this change, much more reliable data. I'll have to take at MarketXLS, and maybe do some refactoring then.
Thanks for your comment. I found a free alternative in case anyone cares: It has come to our attention that this service is being used in violation of the Yahoo Terms of Service. As such, the service is being discontinued. For all future markets and equities data research, please refer to finance. Sign up with Google. Sign up with LinkedIn. Sign up with Facebook. Learn how to match and substitute tagged data using PHP regular expressions.