protected function downloadCertificate($urlParts)
{
$streamContext = stream_context_create(["ssl" => ["capture_peer_cert" => TRUE]]);
$streamClient = stream_socket_client("ssl://{$urlParts['host']}:443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $streamContext);
$certificateContext = stream_context_get_params($streamClient);
return openssl_x509_parse($certificateContext['options']['ssl']['peer_certificate']);
}