回答編集履歴

1

参考コードの追加

2016/12/13 05:21

投稿

motuo
motuo

スコア3027

test CHANGED
@@ -1,3 +1,21 @@
1
1
  以下のサイトが参考になるのではないでしょうか。
2
2
 
3
3
  [参考サイト](http://stackoverflow.com/questions/3081042/how-to-get-ssl-certificate-info-with-curl-in-php)
4
+
5
+
6
+
7
+ ```php
8
+
9
+ $g = stream_context_create (array("ssl" => array("capture_peer_cert" => true)));
10
+
11
+ $r = fopen("https://www.google.com/", "rb", false, $g);
12
+
13
+ $cont = stream_context_get_params($r);
14
+
15
+ $parsed = openssl_x509_parse($cont['options']['ssl']['peer_certificate']);
16
+
17
+ ```
18
+
19
+
20
+
21
+ $parsedの中に、SSLの情報が入ります。