Estou tentando envia um lote de RPS (nota de serviço) para o web service de Curitba (http://pilotoisscuritiba.curitiba.pr.gov.br/nfse_ws/NfseWs.asmx?WSDL), mas estou tendo alguns problemas.
Sempre que envio a requisição por curl ele me retorna erro “403, acesso negado/proibido”. Já consultei os manuais diversas vezes mas não tem muita informação útil.
Código:
$headers = [
'POST /Iss.NfseWebService/nfsews.asmx HTTP/1.1',
'HOST: '.$url,
'Content-Type: text/xml; charset=utf-8',
'Content-Length: '.strlen($xml),
'SOAPAction: http://www.e-governeapps2.com.br/RecepcionarLoteRps'
];
curl_setopt($ch, CURLOPT_URL, 'https://isscuritiba.curitiba.pr.gov.br/Iss.NfseWebService/nfsews.asmx?WSDL');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSLCERT, $path.'_cert.pem'); // certificado do cliente
curl_setopt($ch, CURLOPT_SSLKEY, $path.'_priKEY.pem'); // chave privada
curl_setopt($ch, CURLOPT_SSLCERTTYPE, 'PEM');
curl_setopt($ch, CURLOPT_KEYPASSWD, '******'); // senha do certificado
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
Minhas dúvidas são:
1 - É preciso enviar o login e senha do usuário do ISS? (no headers ou na requisição curl?)
2 - Qual o jeito correto de enviar o certificado pelo curl?
3 - O certificado deve conter a chave privada ou ela deve ser enviada de forma separada?