public function readFromUrl($url, array $options = []): Certificate
    {
        $urlHost = parse_url($url, PHP_URL_HOST);

        if ($urlHost === null) {
            $urlHost = $url;
        }
    
        $urlPort = parse_url($url, PHP_URL_PORT);
    
        if ($urlPort === null) {
            $urlPort = self::DEFAULT_PORT;
        }
    
        $options = $this->prepareReadFromUrlOptions($options);

        $streamContext = stream_context_create(array(
            'ssl' => array(
                'capture_peer_cert' => TRUE,
                'verify_peer'       => FALSE,
                'verify_peer_name'  => FALSE
            )
        ));

        $stream = @stream_socket_client(
            sprintf('ssl://%s:%d', $urlHost, $urlPort),
            $errorNumber,
            $errorString,
            $options[self::OPT_CONNECTION_TIMEOUT],
            STREAM_CLIENT_CONNECT,
            $streamContext
        );

        if ($stream) {
            $streamParams = stream_context_get_params($stream);

            $certResource = $streamParams['options']['ssl']['peer_certificate'];

            return new Certificate($this->certResourceToString($certResource));
        }
        
        throw new Exception(
            sprintf('Unable to connect to %s:%d', $urlHost, $urlPort),
            Exception::CONNECTION_PROBLEM
        );
    }