Histórico

EXIBINDO RESPOSTAS:

Avatar discord do usuario alissonmaciel_32335

alissonmaciel_32335

Ver no Discord

Estou executando este método:
public function webhook() {
$body = '{
"webhookUrl": "https://julioerp.agenciaweblab.com.br/webhook.php"
}';
try {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->config['rotas'] . '/v2/webhook/' . $this->config['chave_pix']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_SSLCERT, $this->config["certificado"]);
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, '');
$headers = array();
$headers[] = 'Authorization: Bearer ' . $this->access_token;
$headers[] = 'X-Skip-Mtls-Checking: true';
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);

echo '

';
var_dump($this->config['chave_pix'], $result);
echo '
';

if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
return $result;
} catch (Exception $e) {
echo '
';
var_dump($e->getCode(), $e->getFile(), $e->getMessage());
echo '
';
}
}

Avatar discord do usuario guilherme_efi

guilherme_efi

Ver no Discord

@alissonmaciel_32335, troque no header o content_type para $headers[] = 'Content-Type: application/json';