0
我正在嘗試將我的Web編輯隊列整合到Trello中。Trello API PHP Curl
我做了一個不是公開的組織,但創建了一個讀/寫訪問令牌。
我還沒有看到對Trello API一個很好的PHP包裝(已經看了兩個可用,不能真正讓他們啓動並運行了我的目的。)
反正想什麼,我要做的是提供相當基本的訪問權限來讀取和插入卡片到特定的列表。
我已經儘可能使用API使用返回一個列表的結果如下得到:
https://api.trello.com/1/lists/[mylistID]/cards?key=[myappkey]&token=[mytoken]
我得到正是我想要的結果,在列表中的卡JSON。
現在我; M嘗試使用捲曲重建,在PHP和我得到未經授權或錯誤的請求的錯誤響應從不管我嘗試下面的代碼:
$url = "https://api.trello.com/1/lists/[myboardID]/cards";
$trello_key = 'mykey';
$trello_list_id = 'mylistid';
$trello_member_token = 'mytoken';
$fields = "key=$trello_key&token=$trello_member_token&name=$name&idList=$trello_list_id";
e
# init curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLINFO_HEADER_OUT, TRUE); // make sure we see the sended header afterwards
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
curl_setopt($ch, CURLOPT_POST, 1);
# dont care about ssl
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
# download and close
$output = curl_exec($ch);
$request = curl_getinfo($ch, CURLINFO_HEADER_OUT);
$error = curl_error($ch);
curl_close($ch);
所以我只是看看是否有人知道我做錯了什麼。我覺得應該很簡單,但我花了幾個小時,我想我需要一些幫助。如果您有任何想法,請告知我。
{我已經離開了明顯的引用我的API密鑰,令牌,板卡ID等}
我試過了,第一個錯誤:'注意:未定義的變量:D:\ LAMP \ www \ a.php中的第21行。檢查是否定義了「$ name」。 –
對不起,我們可以從等式中取名。無論如何,我想我已經解決了它,但仍然在仔細研究如何解析響應。 – mmundiff