【发布时间】:2017-12-14 19:02:47
【问题描述】:
我正在尝试使用 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:443 的未知 SSL 协议错误
我试图改变 SSL_Version 但这也不能解决问题。我知道我所有的数字(token、sheetnum、column num)都是正确的。我尝试过使用其他 api 的人的其他解决方案,但仍然找不到答案。有人对如何解决这个问题有任何想法吗?
谢谢你, 约书亚
【问题讨论】:
-
您检查过以下内容吗? blog.techstacks.com/2010/03/…
-
我刚刚经历了它,但我似乎仍然无法找到问题所在。这是我第一次使用 cURL,所以有些协议对我来说是陌生的。不过还是谢谢
标签: php ssl curl smartsheet-api