我有一个通过 SOAP 调用 Web 服务的 PHP 网站。它正在使用 nusoap 调用 WS。
它在我的本地机器和另一台服务器上运行良好,但在 Heroku 中,抛出了以下异常:
HTTP Error: cURL ERROR: 27: SSL: couldn't create a context: error:140A90C4:SSL routines:SSL_CTX_new:null ssl method passed url: https://xxx/yyy.Services content_type:
代码是:
// Primeiro Try
$obClient = new nusoap_client ( $url_webservice, 'wsdl' );
$obClient->setCurlOption(CURLOPT_SSLVERSION, 4);
$erro = $obClient->getError ();
if ($erro) {
throw new Exception ( "Erro ao conectar", 9999 );
}
$retorno = $obClient->call ( $funcao_chamada, $parametros );
if ($obClient->fault != '') {
$error = $obClient->error_str;
throw new Exception ( utf8_encode ( $error ), 9997 );
}
$erro = $obClient->getError ();
if ($erro) {
$error = $obClient->error_str;
throw new Exception ( utf8_encode ( $error ), 9998 );
}
return $retorno;
}
这是怎么回事?
最佳答案
我正在使用 nusoap.php,我正在调用传递以下参数的方法 setCurlOption:
setCurlOption(CURLOPT_SSLVERSION, 4)
当我评论这一行时,问题就解决了。
关于php - HTTP 错误 : curl ERROR: 27: SSL: couldn't create a context in Heroku,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45045328/