0
I’m doing an integration with Webservice for sending RPS, for NFS-e, I’m using the PHP programming language, and the CURL library. In this integration is mandatory when making any request sending the digital certificate, this we already have and we are sending in the parameter (CURLOPT_SSLKEY) the absolute path of the certificate.
The CURL parameters are as follows:
$_options = array (
CURLOPT_URL => 'https://pilotoisscuritiba.curitiba.pr.gov.br/nfse_ws/NfseWs.asmx?WSDL',
CURLOPT_CONNECTTIMEOUT => 60,
CURLOPT_TIMEOUT => 60,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_SSLKEY => /var/cert/cert.pem, // certificado
CURLOPT_POSTFIELDS => $_content,
CURLOPT_HTTPHEADER => $_header
);
I have the following return :
<?xml version="1.0"?>
<EnviarLoteRpsResposta xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NumeroLote xsi:nil="true"/>
<DataRecebimento xsi:nil="true"/>
<ListaMensagemRetorno>
<MensagemRetorno>
<Codigo>E504</Codigo>
<Mensagem>O certificado digital do prestador de serviços é obrigatório.</Mensagem>
<Correcao>Envie junto a requisição do serviço o certificado digital do prestador de serviços.</Correcao>
</MensagemRetorno>
</ListaMensagemRetorno>
</EnviarLoteRpsResposta>
Has anyone been through this before and/or has any idea how to solve this problem ?
Must pass as string
'/var/cert/cert.pem'
first. Now, it may be that beyond theSSLKEY
(that the private key) needs to specify the public key (using theSSLCERT
). And of course, you need to set the private key password (KEYPASSWD
), if there is any. After all, when you turn off theVERIFYPEER
it ceases to use/verify theCAINFO
, creating security problems, but that’s beside the point.– Inkeliz
I’m sending it like this now: $_options = array ( CURLOPT_URL => $this->_wsdl, CURLOPT_CONNECTTIMEOUT => 60, CURLOPT_TIMEOUT => 60, CURLOPT_RURNTRANSFER => true, CURLOPT_SL_VERIFYHOST => 2, URLOPT_SSL_VERIFYPEPER => 0, CURLOPT_SSLCERT => $this->publicKey, // Public key CURLOPT_SLKEY => $this->privateKey, // Private key CURLOPT_KEYPASSWD => '******', CURLOPT_POSTFILDS => $_content, CURLOPT_HTTHEADER => $_header
#; );
– FCristian
And now it’s returning me an html page : <div id="content"> <div class="content-container"> <fieldset> <H2>403 - Forbidden: Access is denied. </H2> <H3>You do not have permission to view this directory or page using the credentials that you supplied. </H3> </fieldset> </div> </div>
– FCristian
You know what you can be now ?
– FCristian