Search results for 'CGI Example'. 1 post(s) found.

  1. 2007/08/27 Simple CGI Programming in C
2007/08/27 14:15

Simple CGI Programming in C


Here's the simplest C based CGI Example.

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    char *data;

    printf("Content-Type:text/html;\xd\xa"); // HTML out start !!

    printf("<TITLE>Multiplication results</TITLE>\n");
    printf("<H3>Multiplication results</H3>\n");

    data = getenv("QUERY_STRING"); // getting parameters

    if(data == NULL)
      printf("<P>No Query string found");
    else
      printf("<P>%s", data);

    return 0;
}


If you want to run this application on Apache platform, you can test this application by copying to Apache CGI-bin directory.

If it's compiled as test.exe and installed in Apache installed local PC, you can test it by following URL:
http://127.0.0.1/CGI-bin/test.exe


http://127.0.0.1/CGI-bin/test.exe?helloworld

Trackback 3 Comment 0

Trackback : Cannot send a trackbact to this post.

  1. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 00:20 delete

    moneyideas

  2. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 08:47 delete

    moneyideas

  3. Subject different money making ideas

    Tracked from moneyideas 2010/01/31 16:44 delete

    moneyideas