Guys,
I need to generate a text file inline from my code. I know how to generate a downloadable file using an external php script, like this...
PHP Code:
<? //Generate text file on the fly - text.php
header("Content-type: text/plain");
header("Content-Disposition: attachment; filename=savethis.txt");
// do your Db stuff here to get the content into $content
print "This is some text...\n";
print $content;
?>
<a href="text.php">Download me</a>
But I have a very intensive script that does a lot of processing and takes a long time. So what I'd like is to avoid having to do it twice. Anyone know how to do something like this?
PHP Code:
<?
// contact the DB and get lots of info and parse it into $content
print "<html><body>
Read it here<br>
$content<br>
or download it";
//generate the downloadable version here somehow => $contentfile
print "<a href="$contentfile">Here!</a></body></html>";
?>
this would basically be generating a file in memory without having to write a temp file, but do it without having to call an external php script.
Anyone tried something like this before? Help... 
--Viral
Bookmarks