Usei o Curl da Lib PHP, com pequena adição de logs, segue o Curl usado:
php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $pix_url_cob,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 8,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_SSLCERT => $arq_certificado,
CURLOPT_SSLCERTPASSWD => "",
CURLOPT_POSTFIELDS => $body,
CURLOPT_HTTPHEADER => [
"authorization: $tokenType $accessToken",
"Content-Type: application/json",
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
if ($err) {
$this->log->write('emitePix() - Error Curl' . print_r($err, true));
return false;
}
$this->log->write('emitePix() - Error Curl' . print_r($err, true));
$this->log->write('emitePix() - Response ' . print_r($response, true));"
Curioso, que parece ocorrer só nesta chamada, a autorização não ocorre isso.
Uso o PHP 7.2 no servidor e com HTTPS.