title: Calling cloudconvert API inside my REST API
body: <p>I have created a test function in my REST API (using the SLIM framework) for testing my implementation of a wrapper class for the cloudconvert <a href="https://cloudconvert.com/apiconsole" rel="nofollow">API</a>.</p>
  
  <pre><code>$app-&gt;get('/test', 'authenticate', function() use ($app) {
  
      $response = array();
      $converter = new CloudConverter();
      $url = $converter-&gt;createProcess("docx","pdf");
      $response["url"] = $url;  
      echoRespnse(201, $response);            
  
  });
  </code></pre>
  
  <p><strong>My createProcess function inside CloudConverter class looks like this:</strong></p>
  
  <pre><code>public function createProcess($input_format,$output_format)
  {
      $this-&gt;log-&gt;LogInfo("CreateProcess Called");
  
      $headers = array('Content-type: application/json');
      $curl_post_data = array('apikey' =&gt; API_KEY,'inputformat' =&gt; $input_format,'outputformat' =&gt; $output_format);        
      $curl = curl_init(CLOUD_CONVERT_HTTP);
      curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
      curl_setopt($curl, CURLOPT_POST, true);
      curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($curl_post_data));
      $curl_response = curl_exec($curl);
  
      if ($curl_response === false) 
      {
          $info = curl_getinfo($curl);
          curl_close($curl);
          die('error occured during curl exec. Additioanl info: ' . var_export($info));
          $this-&gt;log-&gt;LogInfo('error occured during curl exec. Additioanl info: ' . var_export($info));
      }
  
      curl_close($curl);
      $decoded = json_decode($curl_response,true);
      return $decoded['url']; 
  }
  </code></pre>
  
  <p>I have tested my API using Chrome Advanced Rest Client and i see a successful response from my call to the cloudconvert API but that is not what i was expecting as can be seen in the code above. I was expecting to extract the url and return THAT in my response.</p>
  
  <p><strong>My Questions is:</strong>
  HOW can i extract the url from the response from cloudconvert and return that in my own response. </p>