title: Api.ai API for php (with REST API by POSTing)
body: <p>llo,
  I'm trying to integrate my webapp with  RESTful api in php. This requires me to POST data to <a href="https://api.api.ai/v1/query" rel="nofollow">https://api.api.ai/v1/query</a> and also have 2 custom headers.</p>
  
  <p>my current code is</p>
  
  <pre><code>$data = array("v" =&gt; "20150821", "query" =&gt; "whats the time", "lang" =&gt; "EN", "sessionId" =&gt; "1234567890");                                                                    
  $data_string = json_encode($data);                                                                                   
  
  $ch = curl_init('https://api.api.ai/v1/query');
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      'Content-Type: application/json',
  //    'Content-Length: ' . strlen($data_string),
      'Content-type: application/json',
      'Authorization: Bearer XxxX-xxx',
      'ocp-apim-subscription-key: XxxX-xxx')
  );
  
  $result = curl_exec($ch);
  </code></pre>
  
  <p>If i run this, (with my real auth and key obv) i get nothing. Like Blank. Any ideas? </p>