Skip to content

Instantly share code, notes, and snippets.

@vanbo
Created February 17, 2020 09:47
Show Gist options
  • Select an option

  • Save vanbo/6cbc2c15c34b7f8803dd87bdeb117776 to your computer and use it in GitHub Desktop.

Select an option

Save vanbo/6cbc2c15c34b7f8803dd87bdeb117776 to your computer and use it in GitHub Desktop.
WC Paytrace - Force API to use TLS 1.2
add_action( 'http_api_curl', 'paytrace_http_api_curl', 10, 3 );
/**
* Force posts to Paytrace to use TLS v1.2.
*
* @param string $handle
* @param mixed $r
* @param string $url
*/
function paytrace_http_api_curl( $handle, $r, $url ) {
if ( strstr( $url, 'https://' ) && ( strstr( $url, 'api.paytrace.com' ) || strstr( $url, 'paytrace.com/api' ) ) ) {
curl_setopt( $handle, CURLOPT_SSLVERSION, 6 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment