title: PHP save browser output as file without saving file on server
body: <p>I am trying to create link to save browser output as file without creating file on server.</p>
  
  <p>This is what I got so far:</p>
  
  <pre><code>&lt;?php
  ob_start();
  ?&gt;
  
  &lt;html&gt;
      webpage content
  &lt;/html&gt;
  
  &lt;?php
  $page = ob_get_contents();
  ob_end_flush();
  
  $file= time().'.html';
  
  file_put_contents($file, $page);
  ob_start();
  header('Content-Type: application/octet-stream');
  header('Content-Disposition: attachment; filename="'.basename($file).'"');
  header('Content-Length: ' . filesize($file));
  ob_end_flush();
  ?&gt;
  
  &lt;a href="&lt;?php echo $file; ?&gt;.php"&gt;Download output as file&lt;/a&gt;
  </code></pre>
  
  <p>How can i create such link WITHOUT SAVING file on server?</p>
  
  <p>Thank you for your suggestions/ideas/code.</p>