in reply to Re: Create a html page on fly
in thread Create a html page on fly

Hi

I have tried your suggestion. The page gives a 500 internal server error. The scenario is i have different pages in my main page. Each pages in main page has a link and when clicked has to display the specific page. But now when i click it , its giving a 500 internal server error. The page is being displayed properly when i open it individually. Any suggestions would be really helpful. Thank you Akhila

open my $htmlout, ">tmp/$filename" or die "Cant open: $!\n"; print $htmlout "<HTML>\n"; print $htmlout "<HEAD><TITLE>\n"; print "$i page"; print $htmlout "</TITLE>\n"; print $htmlout "<BODY>\n"; for my $t (@{$res->{result}}) { print $htmlout "$t->{title}<br>"; print $htmlout "$t->{phone}<br>"; } print $htmlout "</BODY></HEAD></HTML>\n"; close $htmlout;

Replies are listed 'Best First'.
Re^3: Create a html page on fly
by marto (Cardinal) on Mar 19, 2012 at 15:31 UTC

    "Any suggestions would be really helpful."

    What does the web server error log say? See also Ovid's CGI Course.

Re^3: Create a html page on fly
by Anonymous Monk on Mar 19, 2012 at 15:48 UTC
      How can i achieve this? My main page is already a cgi page. Should i be adding another print statement with Content-Type?
Re^3: Create a html page on fly
by tangent (Parson) on Mar 19, 2012 at 19:03 UTC
    Once you have created the HTML file you need to print the location of the new file as a URL, something like:
    ... close $htmlout; my $url = "http://example.com/directory/$filename"; print "Location: $url\n\n";