dragon2025 2015-06-23 23:54
浏览 42

Woocommerce:不能再使用sslv3了吗? 使用wp_remote_post

I've been using the PSIGate payment Gateway built by Woothemes for WooCommerce. It's worked for a good two years, up until earlier this month my client's have been unable to process their credit cards. They get the following error:

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.

After doing some research, it looks like it's because we're using SSLv3, and the processor now only accepts TLS.

I'm diving into the plugin code, and this is how the API call is made:

/**
 * 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;

}

They are using the wp_remote_post function to connect to PSI Gate. Do I need to convert this function to a CURL call? What would it look like?

Your help is much appreciated!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)