【问题标题】:php paypal express checkout ssl errorphp paypal express checkout ssl错误
【发布时间】:2016-01-26 04:40:21
【问题描述】:

我使用 paypal express checkout 进行付款集成。它在本地服务器上工作。在线上传文件时显示错误SetExpressCheckout failed: SSL connect error(35)

我使用以下类进行贝宝快速结帐

 class MyPayPal {

    function PPHttpPost($methodName_, $nvpStr_, $PayPalApiUsername, $PayPalApiPassword, $PayPalApiSignature, $PayPalMode) {
            // Set up your API credentials, PayPal end point, and API version.
            $API_UserName = urlencode($PayPalApiUsername);
            $API_Password = urlencode($PayPalApiPassword);
            $API_Signature = urlencode($PayPalApiSignature);

            $paypalmode = ($PayPalMode=='sandbox') ? '.sandbox' : '';

            $API_Endpoint = "https://api-3t".$paypalmode.".paypal.com/nvp";
            $version = urlencode('109.0');

            // Set the curl parameters.
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
            curl_setopt($ch, CURLOPT_VERBOSE, 1);

            //curl_setopt($ch, CURLOPT_SSLVERSION, 3);

            // Turn off the server and peer verification (TrustManager Concept).
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);    

            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_POST, 1);

            // Set the API operation, version, and API signature in the request.
            $nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";

            // Set the request as a POST FIELD for curl.
            curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

            // Get response from the server.
            $httpResponse = curl_exec($ch);

            if(!$httpResponse) {
                exit("$methodName_ failed: ".curl_error($ch).'('.curl_errno($ch).')');
            }

            // Extract the response details.
            $httpResponseAr = explode("&", $httpResponse);

            $httpParsedResponseAr = array();
            foreach ($httpResponseAr as $i => $value) {
                $tmpAr = explode("=", $value);
                if(sizeof($tmpAr) > 1) {
                    $httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];
                }
            }

            if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
                exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
            }

        return $httpParsedResponseAr;
    }

       }

我需要在这里添加任何curl_setopt()。请帮我。谢谢。

【问题讨论】:

    标签: php paypal


    【解决方案1】:

    请尝试:curl_setopt($ch, CURLOPT_SSLVERSION , 1);

    【讨论】:

      猜你喜欢
      • 2011-08-17
      • 2017-05-31
      • 2018-04-27
      • 1970-01-01
      • 2012-07-14
      • 2017-01-08
      • 2017-02-08
      • 2014-04-11
      相关资源
      最近更新 更多