I'm trying to use this api (currency exchange api). This returns something like this:
{
"from":"USD",
"to":"HKD",
"rate":7.7950999999999996958877090946771204471588134765625
}
I send the request with file_get_contents()
and this seems to work.
My problem is that I can't access the array key rate
.
$r = file_get_contents('https://cc.hirak.cc/usd_hkd');
print_r($r['rate']); // nothing is shown. This is the problem.
print_r($r); // result shows ( all the array )
How can I access just the rate
key?