title: Trello API PHP Curl
body: <p>I am trying to integrate/replace my web edit queue into Trello.</p>
  
  <p>I made an organization which is not public but have created a token for read/write access.</p>
  
  <p>I haven't seen a good PHP wrapper for the Trello API (have looked at the two available and couldn't really get them up and running for my purposes.)</p>
  
  <p>Anyway, what I'd like to do is provide rather rudimentary access to read and insert cards to a particular list.</p>
  
  <p>I have gotten as far as using the API to return the results of a List using the following:</p>
  
  <pre><code>https://api.trello.com/1/lists/[mylistID]/cards?key=[myappkey]&amp;token=[mytoken]
  </code></pre>
  
  <p>I get exactly what I want as a result, json of the cards in the list.</p>
  
  <p>Now I;m trying to recreate that in PHP using CURL and I'm getting an error response of unauthorized or bad request from whatever I try in the following code:</p>
  
  <pre><code>$url = "https://api.trello.com/1/lists/[myboardID]/cards";
  $trello_key          = 'mykey';
  $trello_list_id      = 'mylistid';
  $trello_member_token = 'mytoken'; 
  
  $fields = "key=$trello_key&amp;token=$trello_member_token&amp;name=$name&amp;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);
  </code></pre>
  
  <p>So I'm just looking to see if anyone knows what I'm doing wrong. I feel like it should be simple but I've spent a couple hours on it and I think I need some help. Let me know if you have any ideas.</p>
  
  <p>{i have left out obvious references to my API key, token, BoardID etc}</p>