title: Output a PDF in PHP from a byte array
body: <p>I am getting a byte array from a WCF service that generated the PDF and converted it to a byte array. I need to able to get the byte array and using either PHP or Javascript (or jQuery) take that byte array and convert it back to a downloadable PDF. I would prefer a solution in Javascript, but PHP would work fine too.</p>
  
  <p>The code I'm using to get the PDF is:</p>
  
  <pre><code>&lt;?php
      $userPDF = $_POST['username'];
      $passPDF = $_POST['password'];
      $idPDF = 'MO-N007175A';
  
      //PDF Function
      $data = array("id" =&gt; $idPDF, "username" =&gt; $userPDF, "password" =&gt; $passPDF);                                                                    
      $data_string = json_encode($data);                                                
      $ch = curl_init('http://********.com/******/v1/DealPdf');                                                                      
  
      curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
      curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                 
      curl_setopt($ch, CURLOPT_VERBOSE, 1 );
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                
      curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
  
      $result = curl_exec($ch);
      var_dump($result);
  ?&gt;
  </code></pre>
  
  <p>The <code>var_dump($result);</code> is</p>
  
  <p><code>string(1053285) "[37,80,68,70,45,49,46,54,10,37,211,244,204,225,</code> ...</p>
  
  <p>The array goes on for a while... so I only provided a small portion for example purposes.</p>
  
  <p>Where do I start on getting a PDF out of this array?</p>
  
  <p><strong>EDIT</strong> 
  To clarify - The WCF Service IS returning an actual PDF, just in a byte array. I need to save this byte array as a PDF on the clients machine. I have used fwrite and so forth, but I must be missing something because I dont see it working. </p>
  
  <p>Also - If I do use fwrite, where does it output the file?
  <strong>EDIT</strong></p>