Problem recurrence:
<?php
function getCertInfo($domain)
{
$context = stream_context_create([
'ssl' => [
'capture_peer_cert' => true,
'capture_peer_cert_chain' => true,
],
]);
$client = stream_socket_client("ssl://{$domain}:443", $errorCode, $errorMessage, 30, STREAM_CLIENT_CONNECT, $context);
if ($client === false) {
var_dump("!!!open {$domain} socket connection fail. {$errorMessage}($errorCode) !!!";
return false;
}
$params = stream_context_get_params($client);
if (empty($params['options']['ssl']['peer_certificate'])) {
var_dump("!!!{$domain} stream_context_get_params options ssl peer_certificate is empty!!!");
return false;
}
return openssl_x509_parse($params['options']['ssl']['peer_certificate']);
}
Solution: $context add verify_ Peer configuration
<?php
$context = stream_context_create([
'ssl' => [
'capture_peer_cert' => true,
'capture_peer_cert_chain' => true,
'verify_peer' => false,
],
]);
Read More:
- reason 442 failed to enable virtual adapter
- picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resource
- Failed to open stream: http request failed!
- What should be paid attention to in socket programming — bind socket error: address already in use
- Error analysis of veeam backup: failed to create NFC download stream
- error: \*1035 connect() failed (111: Connection refused) while connecting to upstream, client…..
- move_uploaded_file() failed to open stream: Permission denied
- php Error failed to open stream: HTTP request failed!
- [Windows] Socket Server Failed to bind, error 10048
- filezilla Failed to create listen socket on port 21 for IPv4 solution
- Failed to enable APR appears when the cmder of ubutun system in win subsystem installs Apache_ TCP_ DEFER_ ACCEPT
- An idea to solve Warning move_uploaded_file, failed to open stream in the process of php uploading files
- failed to open stream: HTTP wrapper does not support writeable connections
- ASP.NET AJAX client-side framework failed to load
- Failed to connect to Mir:Failed to connect to server socket:No such file or directory
- Failed to create VirtualBox client com
- gvim: GConf-WARNING **: Client failed to connect to the D-BUS daemon
- The fastest way to solve the problem of error reporting from crypto.cipher import AES
- org.apache.flink.runtime.client.JobSubmissionException: Failed to submit JobGraph
- PHP error Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 Fatal error: