world leader in high performance signal processing
Trace:

Differences

This shows you the differences between two versions of the page.

cgi_hello_world [2006/12/08 01:02] (current)
Line 1: Line 1:
 +====== CGI Hello World Example ======
  
 +Here are a few example Hello World CGI applications written in different languages.
 +
 +Please make sure your webserver config has cgi properly set up first.  For example, boa needs to have ''AddType application/x-httpd-cgi cgi'' enabled in boa.conf.
 +
 +Finally, make sure the files are marked with executable permissions on the server.
 +
 +==== Shell Code Example ====
 +
 +<code>
 +#!/bin/sh
 +
 +echo "Content-type: text/html"
 +echo ""
 +
 +echo "<html>"
 +echo "<head><title>CGI example</title></head>"
 +string="Hello world!"
 +cat << EOF
 +<body>
 +$string
 +</body>
 +EOF
 +echo "</html>"
 +</code>
 +
 +==== C Code Example ====
 +
 +<code>
 +#include <stdio.h>
 +
 +int main(int argc, char *argv[])
 +{
 +    printf("Content-type: text/html\r\n");
 +    printf("\r\n");
 +
 +    printf(
 +        "<html>"
 +        "<head><title>CGI example</title></head>"
 +        "<body>Hello world!</body>"
 +        "</html>"
 +    );
 +}
 +</code>