You can do this a number of ways.
Basically (if I understand waht you want to do), you want to create a file from a script, and later open the information generated by that script in a browser.
There are probably at least two reasonably simple approaches
1) you could directly generate the HTML from the script - probably long and tedious
2) you could save the information to a temporary file, which may or may not contain some HTML formatting, and have a generic file (in say php) to create a page using the information in that file.
Probably what I would do, is redirect the output to a .csv file which would look something like (result.csv):
[code]
winner, John
prize, Gold
[code]
you then create a file which includes something like the following php (lottery.php) {I haven't made sure that works so their may be little oversights in it}:
-
<?
-
//Check File exists
-
if(exists_file("result.csv'"))
-
{
-
//Open file for reading
-
$myfile=fopen("result.csv". "r");
-
//read the csvlines - note 1000 here is >= file length- may need to extend if you open bigger files
-
while (($line = fgetcsv($myfile,1000,",")!=false)
-
{
-
echo "<h2>".$line[0]." is ".$line[1]."!!";
-
}
-
}
-
?>
-