這是關於貝寶通過Curl。我試圖通過使用下面的代碼訪問貝寶。代碼在一臺服務器上正常工作。將此代碼移至活動服務器後,獲取以下錯誤。任何人都可以告訴我這個解決方案。貝寶Curl重定向問題
$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 failed: Unknown SSL protocol error in connection to api-3t.sandbox.paypal.com:443 (35)
@Paypa_Robert,感謝您的回覆。剛纔我試着用上面的代碼。還是行不通。同樣的錯誤 – Kishore
確保你已經安裝了最新的openssl或gnutls庫。你可以運行'curl -v https:// api-3t.sandbox.paypal.com/nvp'並在你的問題中包含輸出內容嗎? – Robert