I'm having trouble getting the response I get after submitting 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 get the answer I have in JSON and "separate" the fields I have as a return, for example:
$resposta = httpPost($url, $data); $status = $resposta->{'status'};
Response I get when I run:
{"errors":[{"type":"internal_error","parameter_name":null,"message":"Ocorreu um erro ao cancelar a transferência."}],"url":"URL","method":"post"}
I wanted to print the "message" for example.