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