$config = [
"certificate" => realpath("classes/gerencianet/certificate_homolog.pem"),
"client_id" => "Client_Id_2bc65d226f54d47bec113654a214a1e3e1b1baea",
"client_secret" => "Client_Secret_948041017d8adadea5eaa303fd744db14da94742"
];
$autorizacao = base64_encode($config["client_id"] . ":" . $config["client_secret"]);
$curlauth = curl_init();
console_log($data);
curl_setopt_array($curlauth, array(
CURLOPT_URL => "https://api-pix-h.gerencianet.com.br/oauth/token", // Rota base, homologação ou produção
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => '{"grant_type": "client_credentials"}',
CURLOPT_SSLCERT => $config["certificate"], // Caminho do certificado
CURLOPT_SSLCERTPASSWD => "",
CURLOPT_HTTPHEADER => array(
"Authorization: Basic $autorizacao",
"Content-Type: application/json"
),
));