Histórico de mensagens

EXIBINDO CONVERSAS RECENTES:

# devs
Avatar discord do usuario guilhermecoelhoreal

guilhermecoelhoreal

Ver Respostas

Curl error: could not load PEM client certificate from , OpenSSL error error:02001002:system library:fopen:No such file or directory, (no key found, wrong pass phrase, or wrong file format?)

# devs
Avatar discord do usuario guilhermecoelhoreal

guilhermecoelhoreal

Vou testar aqui

# devs
Avatar discord do usuario guilhermecoelhoreal

guilhermecoelhoreal

Coloquei CURLOPT_SSLCERT => $config["certificado"], no cob

# devs
Avatar discord do usuario rubenskuhl

rubenskuhl

Ver Respostas

Sim

# devs
Avatar discord do usuario guilhermecoelhoreal

guilhermecoelhoreal

Assim?

# devs
Avatar discord do usuario guilhermecoelhoreal

guilhermecoelhoreal

Ver Respostas

curl_setopt_array($curl, array(
CURLOPT_URL => "https://pix.api.efipay.com.br/v2/cob",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_SSLCERT => $config["certificado"],
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer $access_token",
"Content-Type: application/json"
),
));

# devs
Avatar discord do usuario rubenskuhl

rubenskuhl

Ver Respostas

Colocar essa opção de incluir o certificado também na chamada do /cob

# devs
Avatar discord do usuario guilhermecoelhoreal

guilhermecoelhoreal

Ver Respostas

Qual a edição devo fazer, então?

# devs
Avatar discord do usuario rubenskuhl

rubenskuhl

curl_setopt_array

# devs
Avatar discord do usuario rubenskuhl

rubenskuhl

Ver Respostas

Na chamada CURL do /cob, não está

# devs
Avatar discord do usuario guilhermecoelhoreal

guilhermecoelhoreal

Ver Respostas

tá aí

# devs
Avatar discord do usuario rubenskuhl

rubenskuhl

Ver Respostas

CURLOPT_SSLCERT => $config["certificado"],

# devs
Avatar discord do usuario guilhermecoelhoreal

guilhermecoelhoreal

Ver Respostas

Ué, mas qual?

"certificado" => "pix.pem",

# devs
Avatar discord do usuario rubenskuhl

rubenskuhl

Ver Respostas

Mas como eu suspeitei, na geração da cobrança está faltando o certificado.

# devs
Avatar discord do usuario guilhermecoelhoreal

guilhermecoelhoreal

Ver Respostas

Esse é o meu PHP atual, não entendo nada. So mandei minha logica e a IA escreveu

# devs
Avatar discord do usuario guilhermecoelhoreal

guilhermecoelhoreal

O problema é que infos privadas estão aqui, mas tá dboa

# devs
Avatar discord do usuario guilhermecoelhoreal

guilhermecoelhoreal

Tá ai

# devs
Avatar discord do usuario guilhermecoelhoreal

guilhermecoelhoreal

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$cpf = $_POST['cpf'];

// Validação do CPF no servidor
function validarCPF($cpf) {
$cpf = preg_replace('/[^0-9]/', '', $cpf);
if (strlen($cpf) != 11) return false;
if (preg_match('/(\d)\1{10}/', $cpf)) return false;
for ($t = 9; $t < 11; $t++) {
for ($d = 0, $c = 0; $c < $t; $c++) $d += $cpf[$c] (($t + 1) - $c);
$d = ((10
$d) % 11) % 10;
if ($cpf[$c] != $d) return false;
}
return true;
}

if (!validarCPF($cpf)) {
echo "CPF inválido. Tente novamente.";
exit;
}

// Obter o token de acesso
$access_token = obterAccessToken($config);

// Verificar se o token foi obtido
if (!$access_token) {
echo "Não foi possível obter o token de acesso.";
exit;
}

// Gerar a cobrança
$cobranca = gerarCobrancaPix($access_token, $cpf);

// Exibir a resposta
$codigo_pix = $cobranca['pixCopiaECola'] ?? 'Não disponível';
echo "


Código Pix Gerado


Valor: R$ 0.01


Código Pix: {$codigo_pix}


Copiar


";
}
?>