I have this code :
function getCert($domain)
{
$g = stream_context_create(array("ssl" => array("capture_peer_cert" => true)));
$r = stream_socket_client("ssl://{$domain}:443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $g);
$cont = stream_context_get_params($r);
return openssl_x509_parse($cont["options"]["ssl"]["peer_certificate"]);
}
This code works fine with php 7.4 and return the result that I need but when I change the php version to 8.0 returns false without failure