PHP: получить публичный ключ удаленного сервера
Задача: получить публичный ключ https ресурса
Решение:
| 1 2 3 4 5 6 7 8 9 10 11 | <?php $opt = [   "capture_peer_cert" => true,     "capture_peer_cert_chain" => true     ];     $a = stream_context_create(["ssl"=>$opt]);     $b = stream_socket_client("tls://xn--90acbu5aj5f.xn--p1ai:443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $a);     $cont = stream_context_get_params($b);     $key = openssl_pkey_get_public($cont["options"]["ssl"]["peer_certificate"]);     $c = openssl_pkey_get_details($key);     var_dump($c["key"]); |