Summery Summery

Verify the certificate against common name and subject alternative names

Syntax Syntax

Requests_Transport_fsockopen::verify_certificate_from_context( string $host, resource $context )

Description Description

Unfortunately, PHP doesn’t check the certificate against the alternative names, leading things like ‘‘ to be invalid. Instead

Parameters Parameters


(Required) Host name to verify against


(Required) Stream context

Return Return


Source Source

File: wp-includes/Requests/Transport/fsockopen.php

	public function verify_certificate_from_context($host, $context) {
		$meta = stream_context_get_options($context);

		// If we don't have SSL options, then we couldn't make the connection at
		// all
		if (empty($meta) || empty($meta['ssl']) || empty($meta['ssl']['peer_certificate'])) {
			throw new Requests_Exception(rtrim($this->connect_error), 'ssl.connect_error');

		$cert = openssl_x509_parse($meta['ssl']['peer_certificate']);

		return Requests_SSL::verify_certificate($host, $cert);


See also See also


Leave a Reply