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
$hoststringrequired
$contextresourcerequired
*
* @param string $host Host name to verify against
* @param resource $context Stream context
* @return bool
*
* @throws \WpOrg\Requests\Exception On failure to connect via TLS (`fsockopen.ssl.connect_error`)
* @throws \WpOrg\Requests\Exception On not obtaining a match for the host (`fsockopen.ssl.no_match`)
*/
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
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wporg-requests-transport-fsockopen/verify_certificate_from_context