我一直在使用Woothemes为WooCommerce构建的PSIGate支付网关。它工作了两年,直到本月早些时候,我的客户一直无法处理他们的信用卡。他们收到以下错误:
There was an error while processing your request. Error Code: http_request_failed. Error Message: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol.
经过一些研究后,看起来是因为我们使用的是SSLv3,处理器现在只接受TLS。
我正在深入研究插件代码,这就是API调用的方式:
/**
* Process API request and return an XML object of the response
*
* @since 1.1
* @param string $xml The XML string of the request
* @return object|bool The SimpleXMLElement object of the response
*/
public function process_request( $xml, $url ) {
$params = array(
'method' => 'POST',
'sslverify' => false,
'timeout' => 120,
'redirection' => 0,
'body' => $xml,
);
$response = $this->send( $params, $url );
return $response;
}
/**
* Send the POST request and return the response
*
* @since 1.1
* @param array $params
* @return string
* @throws Exception
*/
private function send( $params, $url ) {
// Send the request and get the response
$response = wp_remote_post( $url, $params );
// If Error return the code and message
if ( is_wp_error($response) ) {
throw new Exception( sprintf( __( 'There was an error while processing your request. Error Code: %s. Error Message: %s.', WC_PsiGate::TEXT_DOMAIN ), $response->get_error_code(), $response->get_error_message() ) );
}
return $response;
}
他们正在使用wp_remote_post函数连接到PSI Gate。我是否需要将此功能转换为CURL调用?它会是什么样子?
非常感谢您的帮助!