1

I have used the code like this

$ch2 = curl_init("http://openexchangerates.org/api/currencies.json");
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, 1);

$json2 = curl_exec($ch2);
curl_close($ch2);

$currency = json_decode($json2);

$opts = '';
foreach($currency as $key => $val)
{
$opts .=$key.'=>'.$val.',';
}

return array($opts);

Here I am getting the combo like this everything in a single line

AED=>United Arab Emirates Dirham,AFN=>Afghan Afghani,ALL=>Albanian Lek,...

What can I do for all the currencies listing 1 by 1 ??

1

This works for me:

<?php

$ch2 = curl_init("http://openexchangerates.org/api/currencies.json");
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, 1);

$json2 = curl_exec($ch2);
curl_close($ch2);

$currency = json_decode($json2);

return (array)$currency;
  • Jazakallah !!!!!!! Thank you very much ... Its working – Wazan Aug 24 '12 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.