<?php
$streamContext = stream_context_create(
[
'ssl' => [
'capture_peer_cert' => true,
'capture_peer_cert_chain' => true,
'disable_compression' => true,
],
]
);
$client = stream_socket_client(
'ssl://www.example.com:443',
$errorNumber,
$errorDescription,
40,
STREAM_CLIENT_CONNECT,
$streamContext
);
$meta = stream_get_meta_data($client);
var_dump($meta);
?>
array(8) {
'crypto' =>
array(4) {
'protocol' =>
string(7) "TLSv1.3"
'cipher_name' =>
string(22) "TLS_AES_256_GCM_SHA384"
'cipher_bits' =>
int(256)
'cipher_version' =>
string(7) "TLSv1.3"
}
'timed_out' =>
bool(false)
'blocked' =>
bool(true)
'eof' =>
bool(false)
'stream_type' =>
string(14) "tcp_socket/ssl"
'mode' =>
string(2) "r+"
'unread_bytes' =>
int(0)
'seekable' =>
bool(false)
}