Last active
August 29, 2015 14:15
-
-
Save timersys/f7291521421e005c4d4c to your computer and use it in GitHub Desktop.
wp_remote_get filter to avoid ssl connection problems
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
/** | |
* As many of you know after Poodle was released sslv3 was deactivated all over the internet and new problems arises | |
* when ciphers mismatch. If you get with wp_remote_ errors like: routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure | |
* routines:SSL3_READ_BYTES:sslv3 alert handshake failure or Cannot communicate securely with peer: no common encryption algorithm(s). | |
* Try to add the following action to modify curl. | |
**/ | |
add_action( 'http_api_curl', 'timersys_api_curl', 10, 3 ); | |
function timersys_api_curl(&$handle, $args, $url){ | |
if( strpos($url, 'wp.timersys.com') === false) | |
return $handle; | |
curl_setopt($handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); | |
curl_setopt($handle, CURLOPT_SSL_CIPHER_LIST, 'ecdhe_ecdsa_aes_256_sha'); | |
//curl_setopt($handle, CURLOPT_SSL_CIPHER_LIST, 'TLSv1') // Another to try | |
return $handle; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment