Printing Html in CGI

by Hiroshi on 10-10-2007

Examples of printing HTML in CGI scripts.

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 Script

Download Example

Related Posts

Share it!
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • PDF
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Tumblr
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz
  • Add to favorites
  • Share/Bookmark

Post a Comment

Comment will appear here after approval, Thanks for patience

Searches for Topic