title: PHP REST download file
body: <p>I have a webservice with a function like this</p>
  
  <pre><code>$app-&gt;get('/downloadPdf', function () use($app) 
  {
      $log = 'example.pdf';
      $res = $app-&gt;response();
      $res['Content-Description'] = 'File Transfer';
      $res['Content-Type'] = 'application/octet-stream';
      $res['Content-Disposition'] ='attachment; filename=' . basename($log);
      $res['Content-Transfer-Encoding'] = 'binary';
      $res['Expires'] = '0';
      $res['Cache-Control'] = 'must-revalidate';
      $res['Pragma'] = 'public';
      $res['Content-Length'] = filesize($log);
      readfile($log);
  });
  </code></pre>
  
  <p>Testing it with Advanced Rest Client works fine..</p>
  
  <p>Question is .. how do i call it from my client with all the headers etc.</p>
  
  <p>To specify more. I know there are a lot of examples on how to download a specific file by inserting its url into the curlopt_url with the complete address to the file. What i want is to let the webservice decide which file to return...</p>
  
  <p>Thanks</p>