title: Write a text file and force to download with php
body: <p>Im using a button to direct to a script which creates a text file:</p>
  
  <pre><code>&lt;?php
  $handle = fopen("file.txt", "w");
  fwrite($handle, "text1.....");
  fclose($handle);
  ?&gt;
  </code></pre>
  
  <p>after that I want the web browser to propose to download or open this file
  how should I do? Thanks</p>