Colleagues.
I have a curl which when running brings this value:
login: Fernando Pessoa, password: x2cz
But I need to get that value and play into another curl so that it is logged in automatically. I'm trying this way:
$output = curl_exec($curl); // resultado da curl anterior a essa
$obj = json_decode($output,true);
curk_init();
curl_setopt($curl, CURLOPT_URL, "https://site.com.br/");
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($obj))
);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $obj);
$resultado = curl_exec($curl);
echo $resultado;