title: Reading Displaying and Filtering Woocommerce JSON data from API curl request through PHP
body: <p>I am relatively new to PHP and the wonderful world of API's. To set the scenario for you, we have 12 online stores all on different domains, some on different servers, all localised to local languages etc. All of them are running Wordpress with Woocommerce 2.3.13.</p>
  
  <p>I am currently trying to make a 'web app' type of dashboard that calls Woocommerce data via API and displays it in a friendly manner from all of the stores. I am using PHP/HTML to display the data, I have so far managed to get the orders count for each site without issue. However now I am looking to delve a little more in to the reporting and get some sales figures and various other bits. </p>
  
  <p>To achieve the order count display I have used the following code:</p>
  
  <pre><code>&lt;?php
  $data = array();                                                                    
  $data_string = json_encode($data);                                                                                   
  
  $username = 'ck_111111111111'; // Add your own Consumer Key here
  $password = 'cs_111111111111'; // Add your own Consumer Secret here
  
  $ch = curl_init('https://example.com/wc-api/v2/orders/count/?consumer_key='.$username.'&amp;consumer_secret='.$password);
  curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);                                  
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");                                                                     
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                  
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);                                                                     
  curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
  'Content-Type: application/json',                                                                                
  'Content-Length: ' . strlen($data_string))                                                                       
  );                                                                                                                   
  
  $result = curl_exec($ch);
  $result = json_decode($result,true);
  
  echo $result['count'];
  curl_close($ch);
  
  ?&gt;
  </code></pre>
  
  <p>This displays the order count for that particular woocommerce store. No problem.</p>
  
  <p>But now I would really like to get sales reports, I have tried adding in the date filters on the url, but when putting the date filter on the end of url like this</p>
  
  <pre><code>$ch = curl_init('https://tinywaist.co.uk/wc-api/v2/orders/count/sales?filter[date_min]=2015-01-18&amp;filter[date_max]=2015-01-21?consumer_key='.$username.'&amp;consumer_secret='.$password);
  </code></pre>
  
  <p>I don't get anything back at all.</p>
  
  <p>I have been trying various manipulations on the above code to achieve what I need, I have searched high and low to find a solution to this. What I am really not grasping is how to call specific data from the Woocommerce API and display it on the front end as an array, orders count is as far as I have got.</p>
  
  <p>I have read, re read and re read again the Woocommerce REST API docs, but just cannot seem understand how to apply what I am reading in to a curl command within the PHP.</p>
  
  <p>If you need any more info to help please just ask, I am bald, but if I had hair, I would be tearing it out! </p>
  
  <p>Thanks in advance!</p>