
KevinR
Veteran

May 13, 2005, 12:25 PM
Post #4 of 13
(2648 views)
|
IF you are reading the report in a web browser, like Internet Explorer or Mozilla, you need to use HTML code to display the page properly like any other web page you see on the internet. You could create a simple html file and record the data in that file or use a perl script to open the txt file and generate the html code to display the report formatted for a web browser. One very simple way using perl would be:
#! /usr/local/bin/perl # logger.cgi # version 1.0 # # read the file and format for display in a web browser print "Content-type: text/plain\n\n "; print "<html><head><title>Web Report</title></head>\n"; print "<body bgcolor=\"#FFFFFF\">"; print "<h1>Web Report</h1>\n"; print "<pre style=\"font: normal #000000 'Courier New';\">"; open (MAINLOG, "$mainlog") or die "$!"; while (<MAINLOG>) { print; } close (MAINLOG); print "</pre></body></html>"; exit; most perl coders will recommend you use the CGI module for any html/cgi output, but for a short script like this I see no harm in using hard coded html. See how the above works, you can make it as plain or as fancy as you want by changing the html code. Type the URL of the perl script into your web browsers address box tp run the script, example, if you name the script webreport.pl : http://www.yoursite.com/cgi-bin/webreport.pl -------------------------------------------------
(This post was edited by KevinR on May 13, 2005, 12:31 PM)
|