Created
July 19, 2016 13:12
-
-
Save pounard/6a40174d93925687b00a30cf1ab253fd to your computer and use it in GitHub Desktop.
drupal_http_request() ignore invalid certificates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case 'https': | |
// Note: Only works when PHP is compiled with OpenSSL support. | |
$port = isset($uri['port']) ? $uri['port'] : 443; | |
$socket = 'ssl://' . $uri['host'] . ':' . $port; | |
$options['headers']['Host'] = $uri['host'] . ($port != 443 ? ':' . $port : ''); | |
if (empty($options['context'])) { | |
$options['context'] = stream_context_create(); | |
} | |
stream_context_set_option($options['context'], 'ssl', 'verify_host', false); | |
stream_context_set_option($options['context'], 'ssl', 'verify_peer', false); | |
stream_context_set_option($options['context'], 'ssl', 'verify_peer_name', false); | |
stream_context_set_option($options['context'], 'ssl', 'allow_self_signed', true); | |
break; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment