SetExpressCheckout返回一个空数组

时间:2016-04-04 01:40:06

标签: paypal

在Sandbox中工作,我一直在调整现有应用程序以处理多个结帐项目,但现在SetExpressCheckout返回一个空数组,但我没有看到我的值有任何问题:& Amt = 60& ; PAYMENTACTION =塞尔&安培; RETURNURL = http://system/hg/shirts/PaypalInvoice.php&CANCELURL=http://system/hg/shirts/confirm.php&CURRENCYCODE=USD&SOLUTIONTYPE=Sole&LANDINGPAGE=Login&DESC=HG+Shirt+Order&L_NAME0=MenSmall&L_NUMBER0=001&L_DESC0=Mens+T-Shirt+Small&L_AMT0=20&L_QTY0=3&ITEMAMT=60&TAXAMNT=0

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

    //turning 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);

    //if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
   //Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php 
    if($USE_PROXY)
        curl_setopt ($ch, CURLOPT_PROXY, $PROXY_HOST. ":" . $PROXY_PORT); 

    //NVPRequest for submitting to server
    $nvpreq="METHOD=" . urlencode($methodName) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . "&SIGNATURE=" . urlencode($API_Signature) . $nvpStr . "&BUTTONSOURCE=" . urlencode($sBNCode);

    //setting the nvpreq as POST FIELD to curl
    curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

    // these are supposed to fix Fatal 
    // Error curl_exec for SetExpressCheckout error:"error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure" - Code: 35
    curl_setopt($ch, CURLOPT_SSLVERSION, 3);
    curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'SSLv3');

    //getting response from server
    $response = curl_exec($ch);

    if(!$response)
    {
        die('Fatal Error curl_exec for ' . $methodName . ' error:"' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
    }

1 个答案:

答案 0 :(得分:0)

我找到了答案。不知道为什么我需要这样做,但它解决了问题。

 curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);