This question already has an answer here:
I have a JSON array, I get it from the REST API using curl
and I want to get all the numbers from the "c" column and then find the maximum.
function part of my code
curl_setopt($ch, CURLOPT_URL, "https://api-domain.com/v3/instruments/" . $ticker . "/candles?&price=A&from=" . $first . "&to=" . $second . "&granularity=D");
// get stringified data/output. See CURLOPT_RETURNTRANSFER
$data = curl_exec($ch);
// get info about the request
$info = curl_getinfo($ch);
// close curl resource to free up system resources
curl_close($ch);
$json_string = $data;
$jsondata = ($json_string);
$obj = json_decode($jsondata,true);
print_r($jsondata); //below get the answer
//(print_r output)
{
"instrument":"EUR_USD",
"granularity":"D",
"candles":[
{
"complete":true,
"volume":32813,
"time":"2017-01-02T22:00:00.000000000Z",
"ask":{
"o":"1.04711",
"h":"1.04908",
"l":"1.03413",
"c":"1.04061"
}
},
{
"complete":true,
"volume":34501,
"time":"2017-01-03T22:00:00.000000000Z",
"ask":{
"o":"1.04076",
"h":"1.05009",
"l":"1.03907",
"c":"1.04908"
}
},
{
"complete":true,
"volume":52627,
"time":"2017-01-04T22:00:00.000000000Z",
"ask":{
"o":"1.04911",
"h":"1.06161",
"l":"1.04816",
"c":"1.06083"
}}]}
</div>