Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 10th, 2012  |  syntax: None  |  size: 0.99 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?
  2. $trello_key          = '123412341234123412341234';
  3. $trello_api_endpoint = 'https://api.trello.com/1';
  4. $trello_list_id      = '1234123412341234123412341234';
  5. $trello_member_token = '12341234123412341234123412341234'; // Guard this well
  6.  
  7. $ch = curl_init("$trello_api_endpoint/cards");
  8. curl_setopt_array($ch, array(
  9.         CURLOPT_SSL_VERIFYPEER => false, // Probably won't work otherwise
  10.         CURLOPT_RETURNTRANSFER => true, // So we can get the URL of the newly-created card
  11.         CURLOPT_POST           => true,
  12.         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
  13.                 'key'    => $trello_key,
  14.                 'token'  => $trello_member_token,
  15.                 'idList' => $trello_list_id,
  16.                 'name'   => "Cool Name for a Card",
  17.                 'desc'   => "Try using some\n\n*markdown* in your description"
  18.         )),
  19. ));
  20. $result = curl_exec($ch);
  21. $trello_card = json_decode($result);
  22. $trello_card_url = $trello_card->url;
  23. ?>