Skip to content

Instantly share code, notes, and snippets.

@timersys
Last active Aug 29, 2015
Embed
What would you like to do?
wp_remote_get filter to avoid ssl connection problems
/**
* 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