Search results for 'CGI'. 3 post(s) found.

  1. 2007/08/28 MFC based World Wide Web HTTP Server Source Code
  2. 2007/08/27 Simple CGI Programming in C
  3. 2007/08/27 Simple C# CGI working on Apache
2007/08/28 11:59

MFC based World Wide Web HTTP Server Source Code


The below attachment is HTTP Server Source code that supports CGI.


Detail Description:

HTTPSVR is an MFC sample that demonstrates the use of MFC and its Windows Sockets (WinSock) classes in implementing a simple World Wide Web HTTP Server. HTTPSVR turns any computer connected to a network into a publishing platform viewable from any of a number of web browsers available on the market today, such as Microsoft's Internet Explorer.

HTTPSVR also minimally supports the Common Gateway Interface (CGI). You can create forms and execute CGI-compatible server-side applications using the standard hypertext markup language (HTML) tags.

To increase performance, HTTPSVR checks a file's last modified date and compares it to the date sent by the browser in the HTTP If-Modified-Since field. Most browsers will send this field if they already have a copy of the file in their cache. If the file has not been modified since the date of the cached copy, it will send the browser a Not Modified status code instead of downloading the entire file again.


Trackback 3 Comment 0

Trackback : Cannot send a trackbact to this post.

  1. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 02:18 delete

    moneyideas

  2. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 11:01 delete

    moneyideas

  3. Subject different money making ideas

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

    moneyideas

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

2007/08/27 13:39

Simple C# CGI working on Apache


Simple program to demonstarte the power of c# on the Net. This program require web server e.g(java web server ,apache etc).

Hello.cs
class zzz
{
  public static void Main()
  {
    System.Console.WriteLine("Content-Type:text/html\n");
    System.Console.WriteLine("");
    System.Console.WriteLine("");
    System.Console.WriteLine("Hello to everyone. It's me Kurapa Chunun Kang");
    System.Console.WriteLine("");
  }
}



Compile the class Hello.cs. This will give u a exe file i.e Hello.exe.Put this file in the server's CGI-bin directory. for e.g if u have java server installed in C drive than the place to put the Hello.exe is c:/javawebserver/CGI-bin/" your file i.e hello.exe".
Copy the file Hello.exe to CGI-bin directory. now open the browser window and put the url http://localhost:8080/CGI-bin/Hello.exe considering your server is running at 8080 port.

Trackback 3 Comment 0

Trackback : Cannot send a trackbact to this post.

  1. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 03:26 delete

    moneyideas

  2. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 12:23 delete

    moneyideas

  3. Subject different money making ideas

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

    moneyideas