Hello!
Personal, I would like to understand how to read the return, with the following structure:
$ws = array(
'categoria' => array(
array(
'cat1' => array(
'dado1' => $dado1,
'dado2'=>$dado2
),
'subcategoria'=>array(
'dado3'=>$dado3,
'dado4'=>$dado4,
)
),
),
);
$json = json_encode($ws, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
$url = 'https://link.com';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Accept: application/json',
'Content-Length: ' . strlen($json),
"Content-Type: application/json",
));
$jsonRet = curl_exec($ch);
curl_close($ch);
With the code above, I send it. Now how do I individually extract the return data?
It comes in this format:
{"data":{"nome1":João,"status":["ativo"]}}
I want to be able to interpret only the status, or nome1
, separately with php.