Printing Html in CGI

by Hiroshi on 10-10-2007

Simple html output from cgi script

#!/usr/bin/perl -wt
print "Content-type: text/html\n\n";
print "<html><head><title>Hello World</title></head>\n";
print "<body>\n";
print "<h2>Hello, world!</h2>\n";
print "</body></html>\n";

HTML in CGI Second Example

#!/usr/bin/perl -wt
print "Content-type: text/html\n\n";
print <<EndOfHTML;
<html><head><title>Test Page</title></head>
<body>
<h2>Hello, world! This is cgi and html printing</h2>
</body></html>
EndOfHTML
print end_html;

Download Example

  • Share/Save/Bookmark

Stumble it Digg it Bookmark it Tweet it Share at Facebook

Related Posts

Post a Comment

Comment will appear here after approval, Thanks for patience