'CGI Example'에 해당되는 글 1건
- 2007/08/27 Simple CGI Programming in C
#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;
}
#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

Prev

Rss Feed