I'm trying to print the value from currency converter API JSON data.
Anyone can help me to print the value from this URL
https://free.currencyconverterapi.com/api/v5/convert?q=USD_IDR&compact=y?
I'm trying to print the value from currency converter API JSON data.
Anyone can help me to print the value from this URL
https://free.currencyconverterapi.com/api/v5/convert?q=USD_IDR&compact=y?
You have to use file_get_contents() along with json_decode()
<?php
$json_data = file_get_contents('https://free.currencyconverterapi.com/api/v5/convert?q=USD_IDR&compact=y');
$array = json_decode($json_data, true);
var_dump($array["USD_IDR"]["val"]);
?>
I have tested it on the local machine and working fine:-