Hi all,
I have a script which I need to run which takes anywhere from 10-20 minutes to proccess all of the information. (Lots of mathematical calculations) Clearly, I do not want to have the user to sit and stare at the screen, so I'd rather save the output to a file and than give the user a link to the cached output.
My problem is that I can't get the script to save its entire output into an html file, it always gets cut off. Ie..
$url = "http://xxx.xxx.com/xxx/report.php?sid=xxx&month=xxx&year=xxx";
$HTML_output = "";
$read = fopen ( $url , "r" );
// read the HTML output
while ($line = fgets ( $read , 256 ))
{
$HTML_output.= $line ."\n";
}
fclose ( $read );
//write stuff
$fp = fopen($save_path.'/'.$dest, 'a'); #open for writing
fputs($fp, $HTML_output;); #write all of $data to our opened file
fclose($fp); #close the file
The problem is, sometime around 800KB of script output the file gets saved, when I know there is more output coming. Any ideas why? Better yet, is there a better way to direct the output of a php script directly to a file?
Thanks for all ideas and suggestions.