Paypal Curl重定向问题

时间:2014-01-06 20:19:46

标签: php curl paypal

这是关于通过Curl的paypal。我试图通过使用下面的代码访问paypal。代码在一台服务器上正常运行。将此代码移动到实时服务器后,得到以下错误。任何人都可以告诉我解决方案。

     $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
     $version = urlencode('76.0');
     $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);

错误:

  

SetExpressCheckout失败:与api-3t.sandbox.paypal.com:443(35)有关的未知SSL协议错误

2 个答案:

答案 0 :(得分:0)

可以设置curl_setopt($ch, CURLOPT_SSLVERSION, 3);吗?

答案 1 :(得分:0)

curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);

我在代码中插入了这一行

你有没有尝试过这种替代方案?