Requests_Transport_fsockopen::verify_certificate_from_context()
Verify the certificate against common name and subject alternative names
Unfortunately, PHP doesn't check the certificate against the alternative names, leading things like 'https://www.github.com/' to be invalid. Instead
{} It's a method of the class: Requests_Transport_fsockopen{}
No Hooks.
Return
true|false
.
Usage
$Requests_Transport_fsockopen = new Requests_Transport_fsockopen(); $Requests_Transport_fsockopen->verify_certificate_from_context( $host, $context );
- $host(string) (required)
- Host name to verify against
- $context(resource) (required)
- Stream context
Notes
- See: https://tools.ietf.org/html/rfc2818#section-3.1 RFC2818, Section 3.1
Code of Requests_Transport_fsockopen::verify_certificate_from_context() Requests Transport fsockopen::verify certificate from context WP 6.0
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); }