2

我在尝试与 paypal api 通信时不断收到此消息

这是我的 PayPal 课程

<?php
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);

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

}
?>

我在远程服务器上得到了这个响应:

SetExpressCheckout failed: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure(35)

我已经阅读了一些关于它的主题,但似乎没有任何帮助。

我知道 PayPal 正在使用他们的 api 做一些事情,但问题是,我的代码在 localhost 上工作得很好,但在远程服务器上似乎失败了(我也获得了 SSL 证书以防万一,也没有任何改变)

有人可以解释一下,就好像我很笨一样,我应该遵循什么程序?服务器端说这不是他们的错......(我不知道这是多么真实......)

编辑: 2 周前,完全相同的代码,顺便说一句,在服务器上工作得很好

4

1 回答 1

2

阅读POODLE Vunlerability并按照该指南中的信息进行修复。

PayPal 刚刚在 2016 年 1 月 19 日正式开启了开关,这就是为什么你的东西以前有效而现在无效的原因。

于 2016-02-02T07:12:07.017 回答