![](/img/trans.png)
[英]Unknown SSL protocol error in connection to www.googleapis.com:443 PHP google anaytlics api
[英]PHP Error:Unknown SSL protocol error in connection to api.smartsheet.com:443
我正在嘗試使用 PHP/cURL 連接到智能表 API。
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.smartsheet.com/2.0/sheets/xxxxxxxxx/rows");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"[{\"toTop\":true, \"cells\": [ "
. "{\"columnId\": xxxxxxxx, \"value\": description},"
. "{\"columnId\": xxxxxxxx, \"value\": amount},"
. "{\"columnId\": xxxxxxxx, \"value\": po},"
. "{\"columnId\": xxxxxxxx, \"value\": wo},"
. "{\"columnId\": xxxxxxxx, \"value\": contractor},"
. "{\"columnId\": xxxxxxxx, \"value\": vendorcode},"
. "{\"columnID\": xxxxxxxx, \"value\": notes}]");
curl_setopt($ch, CURLOPT_POST, 1);
$headers = array();
$headers[] = "Authorization: Bearer xxxxxxxx";
$headers[] = "Content-Type: application/json";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
?>
由於某種原因,每次運行時我都會收到以下錯誤:
連接到 api.smartsheet.com 時出現未知的 SSL 協議錯誤:443
我試圖改變 SSL_Version 但這也不能解決問題。 我知道我所有的數字(token、sheetnum、column num)都是正確的。 我嘗試過使用其他 api 的人的其他解決方案,但仍然找不到答案。 有沒有人對如何解決這個問題有任何想法?
謝謝你,約書亞
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
這會強制執行 SSLv3,該協議出於安全原因已經過時了一段時間。 而且, 查看服務器的配置,它不支持與大多數其他服務器類似的 SSLv3。
我建議簡單地刪除這一行,讓 curl 自己選擇最好的版本。
我試圖改變 SSL_Version 但這也不能解決問題。
它可能無法解決問題,因為您沒有從服務器獲得預期的響應。 它可能會刪除您面臨的特定 SSL 問題,以便您繼續解決您的代碼可能遇到的其他問題。 仔細查看任何可能更改的錯誤消息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.