Problem consuming webservice SPC Brasil in PHP

0

Good afternoon, I've been trying to make a webservice in PHP that works with SOAP, but I've never been successful. What came closest was working with cURL but after a strange message I can not do it anymore. nothing after this message. Does anyone know how I can retrieve the query data and how to use it in the system. Ps. I accept suggestions of other methods of consumption of this webservice, I already tried nuSoap and SoapClient without success too.

The cURL request follows:

    <?php

$wsdl = "https://treina.spc.org.br/spc2/remoting/ws/consulta/consultaWebService?wsdl"; // asmx URL of WSDL

$xml = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservice.consulta.spcjava.spcbrasil.org/">
   <soapenv:Header/>
   <soapenv:Body>
      <web:filtro>
         <codigo-produto>4</codigo-produto>
         <!--Optional:-->
         <tipo-consumidor>J</tipo-consumidor>
         <!--Optional:-->
         <documento-consumidor>07887798000184</documento-consumidor>
         <!--Optional:-->
         <cep-consumidor>04003010</cep-consumidor>
         <!--Optional:-->
         <telefone-consultar>
            <ddd>11</ddd>
            <numero>35496800</numero>
         </telefone-consultar>
         </web:filtro>
   </soapenv:Body>
</soapenv:Envelope>';

$usuario = "usuario";  //  username
$senha = "senha"; // password

$process = curl_init($wsdl);
curl_setopt($process, CURLOPT_HTTPHEADER, array(
   'Cache-Control: no-cache',
   'Content-Length: 1799',
   'Set-Cookie: $version=0',
   'path=/spc;',
   'Content-Type: text/xml', $xml));
curl_setopt($process, CURLOPT_HEADER, 1);
curl_setopt($process, CURLOPT_USERPWD, $usuario . ":" . $senha);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
$return = curl_exec($process);
curl_close($process);

if($return){
   echo 1;
   echo var_dump($return);

}else{
   echo 0;
}

and follows the response I have when running:

Youareistheimagewiththeerror,printsthefollowing:1string(1331)"HTTP / 1.1 408 Request Timeout Content-Type: text / html Cache-Control: no-cache Connection: close Content-Length: 805 X-Iinfo: 11046856-0 Set-Cookie: visid_incap_1843551 = MeFMBnQESiCAh8gB9ppvmzRv9VsAAAAAQUIPAAAAAAAnay4vZ6F5qrd981e0SJBY; expires = Thu, 21 Nov 2019 08 NNNN RT (1542811444515 139) q (0 0 5 2) r (300 -1) b2 Strict-Transport-Security: max-age = 31536000 : 08: 00 GMT; path = /; Domain = .spc.org.br Set-Cookie: incap_ses_208_1843551 = t4mifJG1yGnuKjzOQPjiAlJv9VsAAAAAwLxXvlcQklQIaUKbddel8Q ==; path = /; Domain = .spc.org.br

output: 1string (1331) "HTTP / 1.1 408 Request Timeout Content-Type: text / html Cache-Control: no-cache Connection: close Content-Length: 805 X-Iinfo: 9-11046856-0 NNNN RT (1542811444515 139) 0 0 5 2) r (300 -1) b2 Strict-Transport-Security: max-age = 31536000 Set-Cookie: visid_incap_1843551 = MeFMBnQESiCAh8gB9ppvmzRv9VsAAAAAQUIPAAAAAAAnay4vZ6F5qrd981e0SJBY; expires = Thu, 21 Nov 2019 08:08:00 GMT; path = /; Domain = .spc.org.br Set-Cookie: incap_ses_208_1843551 = t4mifJG1yGnuKjzOQPjiAlJv9VsAAAAAwLxXVlcQklQIaUKbddel8Q ==; path = /; Domain = .spc.org.br

If anyone can help me, I've even thought about rebuilding the system in another language but I'm afraid to run into the same problem.

    
asked by anonymous 21.11.2018 / 15:49

0 answers