title: How to debug curl in PHP and Azure
body: <p>Ok, I've got a Drupal site which I'm deploying on Azure. My App perform an API call to Marketo to trigger an action in Marketo's API.</p>
  
  <p>On my local dev and on a Debian server (regular lamp stack) all works fine.</p>
  
  <p>When I deploy the site to Azure, it doesn't work and all I get is <code>NULL</code>.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>    public function postData(){
          $url = $this-&gt;host . "/rest/v1/campaigns/" . $this-&gt;id . "/schedule.json?access_token=" . $this-&gt;getToken();
          $ch = curl_init($url);
          $requestBody = $this-&gt;bodyBuilder();
          print_r($requestBody);
          curl_setopt($ch,  CURLOPT_RETURNTRANSFER, 1);
          curl_setopt($ch, CURLOPT_HTTPHEADER, array('accept: application/json','Content-Type: application/json'));
          curl_setopt($ch, CURLOPT_POST, 1);
          curl_setopt($ch, CURLOPT_VERBOSE, true);
          curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody);
          curl_getinfo($ch);
          $response = curl_exec($ch);
          dvm($response, $name = NULL);
          return $response;
      }
  
      private function getToken(){
          $ch = curl_init($this-&gt;host . "/identity/oauth/token?grant_type=client_credentials&amp;client_id=" . $this-&gt;clientId . "&amp;client_secret=" . $this-&gt;clientSecret);
          curl_setopt($ch,  CURLOPT_RETURNTRANSFER, 1);
          curl_setopt($ch, CURLOPT_HTTPHEADER, array('accept: application/json',));
          curl_setopt($ch, CURLOPT_VERBOSE, true);
          $response = json_decode(curl_exec($ch));
          curl_close($ch);
          $token = $response-&gt;access_token;
          dvm($response, $name = NULL);
          return $token;
      }
  </code></pre>
  
  <p><strong>Please note:</strong></p>
  
  <p>There are 2 calls: one to get the access_token and another the actual trigger.</p>
  
  <p><code>dvm($response, $name = NULL);</code> in simplistic terms is a Drupal equivalent to <code>print_r</code></p>
  
  <p>This exact same code works on my local machine (OS X, Apache, PHP5.6) and on Debian (Apache, PHP 5.6).</p>
  
  <p>I'm using SQLite which is not exactly relevant but I though I should add just in case.</p>
  
  <p>When I execute this code locally or on the Debian server I get the <code>$result</code> variable printed which tells me whether it was successful or not. On Azure I get just <code>NULL</code> for the first <code>FALSE</code> to the second.</p>
  
  <p>The variables (<code>$this-&gt;id</code>, <code>$this-&gt;getToken()</code>, etc) are correctly set and I can I print them fine. Like I said, all works locally.</p>
  
  <p>What am I missing?</p>