Using the Header function you can tell the browser to prompt the download window by setting:
header("Content-Disposition: attachment; filename=download.txt");
where filename is whatever you want the file name to be.
Also be sure to set the content type with
header("Content-Type: text/plain");
Make sure you do this before you output any text, because once text is outputted, the header is sent, and you can't change it anymore.
and also check the link for anything i might be missing.