Zend framework Zend Framework 2 Zend_Http_客户端SSL连接错误

Zend framework Zend Framework 2 Zend_Http_客户端SSL连接错误,zend-framework,zend-framework2,Zend Framework,Zend Framework2,我想解析各种ssl/https站点 我想要的内容,但它不起作用。出现以下错误: Fatal error: Uncaught exception 'ErrorException' with message 'stream_socket_enable_crypto() [<a href='function.stream-socket-enable-crypto'>function.stream-socket-enable-crypto</a>]: SSL opera

我想解析各种ssl/https站点

我想要的内容,但它不起作用。出现以下错误:

    Fatal error: Uncaught exception 'ErrorException' with message 'stream_socket_enable_crypto() [<a href='function.stream-socket-enable-crypto'>function.stream-socket-enable-crypto</a>]: 
SSL operation failed with code 1. 
OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed' 
in C:\Users\Privat\Desktop\Server\Apache2\htdocs\allsubmitter\server\vendor\zendframework\zend-http\Zend\Http\Client\Adapter\Socket.php:276 
Stack trace: #0 [internal function]: Zend\Stdlib\ErrorHandler::addError(2, 'stream_socket_e...', 'C:\Users\Privat...', 276, Array) #1 C:\Users\Privat\Desktop\Server\Apache2\htdocs\allsubmitter\server\vendor\zendframework\zend-http\Zend\Http\Client\Adapter\Socket.php(276): stream_socket_enable_crypto(Resource id #35, true, 2) 
#2 C:\Users\Privat\Desktop\Server\Apache2\htdocs\allsubmitter\server\vendor\zendframework\zend-http\Zend\Http\Client.php(1356): Zend\Http\Client\Adapter\Socket->connect('microsoft.de', 443, true) #3 C:\Users\Privat\Desktop\Server\Apache2\htdocs\ in C:\Users\Privat\Desktop\Server\Apache2\htdocs\allsubmitter\server\vendor\zendframework\zend-http\Zend\Http\Client\Adapter\Socket.php on line 299




$config = array(
        'adapter'      => 'Zend_Http_Client_Adapter_Socket',
        'ssltransport' => 'tls'
);
$client = new \Zend\Http\Client("https://microsoft.de");
致命错误:未捕获异常“ErrorException”,消息为“stream\u socket\u enable\u crypto()[]:
SSL操作失败,代码为1。
OpenSSL错误消息:错误:14090086:SSL例程:SSL3\u获取\u服务器\u证书:证书验证失败'
在C:\Users\Privat\Desktop\Server\Apache2\htdocs\allsubmiter\Server\vendors\zendframework\zend http\zend\http\Client\Adapter\Socket.php中:276
堆栈跟踪:#0[内部函数]:Zend\Stdlib\ErrorHandler::addError(2,'stream\u socket\e…','C:\Users\Privat…',276,Array)#1c:\Users\Privat\Desktop\Server\Apache2\htdocs\allsubmitter\Server\vendors\zendframework\Zend http\Zend\http\Client\Adapter\socket.php(276):stream\u socket\u enable\u-enable\u-ency加密(资源id 35,true,2)
#2 C:\Users\Privat\Desktop\Server\Apache2\htdocs\allsubmiter\Server\vendors\zendframework\zend http\zend\http\Client.php(1356):zend\http\Client\Adapter\Socket->connect('microsoft.de',443,true)#3 C:\Users\Privat\Desktop\Server\Apache2\htdocs\在C:\Users\Privat\Desktop\Server\Apache2\htdocs\allsubmitter\Server\vendors\zendframework\zend http\zend\http\Client\Adapter\Socket.php中,第299行
$config=array(
“适配器”=>“Zend\u Http\u客户端\u适配器\u套接字”,
“SSLTTransport”=>“tls”
);
$client=new\Zend\Http\client(“https://microsoft.de");

您可以告诉客户端不要验证SSL,请尝试以下配置:

$clientConfig = array(
    'adapter' => 'Zend\Http\Client\Adapter\Curl',
    'curloptions' => array(
        CURLOPT_FOLLOWLOCATION => TRUE,
        CURLOPT_SSL_VERIFYPEER => FALSE
    ),
);

$this->_client = new \Zend\Http\Client('https://microsoft.de', $clientConfig);

我还认为你在混合ZF2和ZF2符号,使用下划线而不是等距的类名。为什么你说我混合了ZF2和ZF2。为什么zf2和zf2:D。为什么你说我应该使用带下划线的“旧”样式而不是名称空间?或者我不明白你的意思。非常感谢。为什么你的代码像charm一样工作,而不是使用“默认”fsocket?你的适配器使用的是老式下划线,它需要像我在ZF2中使用的那样命名。但是使用curl适配器可以禁用SSL检查,如果您检查文档,也可以通过套接字进行检查,很高兴它有帮助:)