I'm trying to get informations from a Web Service with SoapClient, but for some reason, when I execute the code, it stays loading until timeout, and doesn't show any error. I already tried to set php.ini
with extension=php_openssl.dll
and set extension=php_soap.dll
, tried to execute the code in xampp, in a website hosting and the error persists. In a moment I thought it was a problem in the page, but the link works fine https://ws.correios.com.br/calculador/CalcPrecoPrazo.asmx?WSDL
.
Here is my function:
$options = [
'cache_wsdl' => WSDL_CACHE_NONE,
'trace' => 1,
'stream_context' => stream_context_create(
[
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
]
]
)
];
$client = new SoapClient('https://ws.correios.com.br/calculador/CalcPrecoPrazo.asmx?WSDL', $options);
$parametros = array('nCdServico' => '04510', 'sCepOrigem' => '82220020', 'sCepDestino' => '08090284');
$response = $client->CalcPrazo($parametros);
var_dump($response);
Aucun commentaire:
Enregistrer un commentaire