Leave a reply
Get currency from Bloomberg with PHP without API Key
Another way to get currency from Bloomberg with PHP function without API Key.
function get_currency( $from = null, $to = null ) { $get = file_get_contents('https://www.bloomberg.com/markets/api/security/currency/cross-rates/USD,EUR,JPY,GBP,IDR'); if ( $to && $from ) { return json_decode( $get )->data->$from->$to; } else if ( $from ) { return json_decode( $get )->data->$from; } else { return json_decode( $get )->data; } }
- Add ISO currency code after cross-rates
- return is array object
For API reference, learnĀ at Blooberg API
Function Snippet by gueprogramer