在magento下的sslv3警报握手失败

时间:2016-03-17 07:37:26

标签: php magento ssl curl paypal

我在magento开发了一个paypal pro。

我的paypal代码如下所示:

$api_username = 'sdk-three_api1.sdk.com';
$api_password = 'QFZCWN5HZM8VBG7Q';
$api_signature = 'A.d9eRKfd1yVkRrtmMfCFLTqa6M9AyodL0SJkhYztxUi8W9pCXF6.4NI';
$api_version = '57.0';
$api_endpoint = 'https://api-3t.sandbox.paypal.com/nvp';

    $request_params = array
    (
        'METHOD' => 'DoDirectPayment', 
        'USER' => $api_username, 
        'PWD' => $api_password, 
        'SIGNATURE' => $api_signature, 
        'VERSION' => $api_version, 
        'PAYMENTACTION' => 'Sale',                   
        'IPADDRESS' => $_SERVER['REMOTE_ADDR'],
        'CREDITCARDTYPE' => $params['creditCardType'], 
        'ACCT' => $params['creditCardNumber'],                        
        'EXPDATE' => $params['expDateMonth'].$params['expDateYear'],           
        'CVV2' => $params['cvv2Number'], 
        'FIRSTNAME' => 'Tester', 
        'LASTNAME' => 'Testerson', 
        'STREET' => '707 W. Bay Drive', 
        'CITY' => 'Largo', 
        'STATE' => 'FL',                     
        'COUNTRYCODE' => 'US', 
        'ZIP' => '33770', 
        'AMT' => $plan_data['amount'], 
        'CURRENCYCODE' => 'USD', 
        'DESC' => 'Testing Payments Pro'
    );

    $nvp_string = '';
    foreach($request_params as $var=>$val)
    {
        $nvp_string .= '&'.$var.'='.urlencode($val);    
    }
    //var_dump($nvp_string); die;
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_VERBOSE, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($curl, CURLOPT_TIMEOUT, 30);
    curl_setopt($curl, CURLOPT_URL, $api_endpoint);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $nvp_string);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_SSLVERSION, 3);
    curl_setopt($curl, CURLOPT_SSL_CIPHER_LIST, 'SSLv3');
    //curl_setopt($curl, CURLOPT_SSL_CIPHER_LIST, 'TLSv1');

    $result = curl_exec($curl);     
    if (curl_errno($curl))
    {
        echo "CURL send a error during perform operation: ".curl_error($curl);
    } 
    else 
    {
        curl_close($curl);
    }

    // Parse the API response
    $nvp_response_array = parse_str($result);
    var_dump($result);  

但是我收到了像

这样的错误
  

错误:14094410:SSL例程:SSL3_READ_BYTES:sslv3警报握手   失败

如果我没有添加这两行

curl_setopt($curl, CURLOPT_SSLVERSION, 3);
curl_setopt($curl, CURLOPT_SSL_CIPHER_LIST, 'SSLv3');

然后给我一个像

这样的错误
  

错误:14077410:SSL例程:SSL23_GET_SERVER_HELLO:sslv3警报握手失败

任何帮助?

1 个答案:

答案 0 :(得分:0)

最近Sandbox有一些更新,稍后需要在Live上应用更新,post会帮助您