2
I’m having trouble getting the answer I have after sending a request via POST
function httpPost($url, $data) { $curl = curl_init($url); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($curl); curl_close($curl); return $response; }
After that I wanted to take this answer that I have in JSON and "separate" the fields that I have as return, for example:
$resposta = httpPost($url, $data); $status = $resposta->{'status'};
Answer I get when I execute:
{"errors":[{"type":"internal_error","parameter_name":null,"message":"Ocorreu um erro ao cancelar a transferência."}],"url":"URL","method":"post"}
I wanted to print "message" for example.