Hello World Sample
The Hello World Sample CGI displays the phrase Hello World in a web browser window.
What You See When you Run HelloWorld.exe |
Hello World
|
Click Here to download this compiled CGI.
Running The Hello World Sample
The Hello World Sample can be run on the same computer as MyWebServer. Just type the following URL into your web browser.
http://localhost/cgi-bin/HelloWorld.exe
The C Version of Hello World |
#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[])
{
printf("Content-type: text/html\n\n");
printf("<HTML>");
printf("<HEAD>");
printf("<TITLE>");
printf("Hello World");
printf("</TITLE>");
printf("</HEAD>");
printf("<BODY>");
printf("<H2>Hello World</H2>");
printf("</BODY>");
printf("</HTML>");
return 0;
}
|
Click Here to download this file.
The PERL Version of Hello World |
#!/usr/local/bin/perl
print ("Content-type: text/html\n\n");
print ("<HTML>");
print ("<HEAD>");
print ("<TITLE>");
print ("Hello World");
print ("</TITLE>");
print ("</HEAD>");
print ("<BODY>");
print ("<H2>Hello World</H2>");
print ("</BODY>");
print ("</HTML>");
|
Click Here to download this file.
Running The Hello World Sample
The Hello World Sample can be run on the same computer as MyWebServer. Just type the following URL into your web browser.
http://localhost/cgi-bin/HelloWorld.exe
|