title: How to generate a pdf document using an API?
body: <p>I use API to generate pdf document. In documentation for this API I have:</p>
  
  <pre><code>http://...../view_awb.php?user=nume_utilizator&amp;parola=123456&amp;awb=CGS12345678A
  If success, the view_awb.php file will return a PDF document
  </code></pre>
  
  <p>next, I have these code:</p>
  
  <pre><code>require "../dbcommon2.php";
  
  $url = "http://webexpress.cargus.ro/custom_print/shipment_import/view_awb.php?user=canai_test&amp;parola=test&amp;awb=TSD21185178T";
  
  $pdf = file_get_contents($url, false);
  require_once("../../dompdf/dompdf_config.inc.php");
  $dompdf = new DOMPDF();
  $dompdf-&gt;load_html($pdf);
  $dompdf-&gt;render();
  $dompdf-&gt;stream("sample.pdf");
  </code></pre>
  
  <p>All looks correctly, but when I open pdf file I see only</p>
  
  <pre><code>%PDF-1.3 3 0 obj &gt; endobj 4 0 obj &gt; stream  xY[ sÚ8¾ï¯Ðe{UgÙ¹£tèd!KHg/:³ãñ.`Öì7ýõß«Æ6HM;M¤WÞÃ£G¡oýûáHL"ð¥D¦é4Á
  </code></pre>
  
  <p>Where is the problem? How can I generate correctly pdf file ?
  I open pdf file sample.pdf by Adobe Reader</p>