I have no expertise in Curl, php or json. I need to get a specific variable from an external page in order to store it later in my mysql database. In this case, I need to get the result value from "transferencia" under the label USD. I tried some examples given from different pages but no success. The page to extract the value is https://s3.amazonaws.com/dolartoday/data.json
I tried this code, but prints an array, I only need one value.
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_URL, "https://s3.amazonaws.com/dolartoday/data.json?dolarp=$transferencia");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($ch);
curl_close($ch);
$json = json_decode($res, true);
print_r($json);
I will appreciate it!