
Untitled
By: a guest on
Jul 10th, 2012 | syntax:
None | size: 0.99 KB | hits: 12 | expires: Never
<?
$trello_key = '123412341234123412341234';
$trello_api_endpoint = 'https://api.trello.com/1';
$trello_list_id = '1234123412341234123412341234';
$trello_member_token = '12341234123412341234123412341234'; // Guard this well
$ch = curl_init("$trello_api_endpoint/cards");
curl_setopt_array($ch, array(
CURLOPT_SSL_VERIFYPEER => false, // Probably won't work otherwise
CURLOPT_RETURNTRANSFER => true, // So we can get the URL of the newly-created card
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query(array( // if you use an array without being wrapped in http_build_query, the Trello API server won't recognize your POST variables
'key' => $trello_key,
'token' => $trello_member_token,
'idList' => $trello_list_id,
'name' => "Cool Name for a Card",
'desc' => "Try using some\n\n*markdown* in your description"
)),
));
$result = curl_exec($ch);
$trello_card = json_decode($result);
$trello_card_url = $trello_card->url;
?>