Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用PHP从特定url获取ssl证书数据时出现问题_Php_Ssl Certificate - Fatal编程技术网

使用PHP从特定url获取ssl证书数据时出现问题

使用PHP从特定url获取ssl证书数据时出现问题,php,ssl-certificate,Php,Ssl Certificate,我想用PHP获取所有SSL证书数据,因为我在下面的代码中已经完成了 $url = "http://www.google.com"; $orignal_parse = parse_url($url, PHP_URL_HOST); $get = stream_context_create(array("ssl" => array("capture_peer_cert" => TRUE))); $read = stream_socket_client("ssl://".$orignal_p

我想用PHP获取所有SSL证书数据,因为我在下面的代码中已经完成了

$url = "http://www.google.com";
$orignal_parse = parse_url($url, PHP_URL_HOST);
$get = stream_context_create(array("ssl" => array("capture_peer_cert" => TRUE)));
$read = stream_socket_client("ssl://".$orignal_parse.":443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $get);
$cert = stream_context_get_params($read);
$certinfo = openssl_x509_parse($cert['options']['ssl']['peer_certificate']);
有了这些,我获得了关于SSL证书的所有详细信息,除了密钥大小、弱密钥、SSL证书类型、公钥算法、指纹(SHA256)详细信息


有人能帮我吗这回答了你的问题吗@Prabhjotsinghkaint不,这个问题与我的问题无关,这个问题给出了数组([options]=>Array([ssl]=>Array([capture\u peer\u cert]=>1[peer\u certificate]=>Resource id#4)))类型的资源(4)(OpenSSL X.509)与我的工作无关的结果question@PrabhjotSinghKainth事实上,这个问题的答案并没有给出我想要的数据