CGI Executable

Problems with the Windows version of XAMPP, questions, comments, and anything related.

CGI Executable

Postby MyOverflow » 22. February 2008 12:28

How do I get XAMPP to use an executable file as a CGI script? I've written the executable in C, here's the C source code:
Code: Select all
#include <stdio.h>
#include <stdlib.h>

int main() {
   char *buf;
   printf("%s%c%c\n", "Content-type=text/html;charset:iso-8859-1",13,10);
   printf("<html>\n<head>\n<title>CGI EXE</title>\n</head>\n<body>\n<p>");
   printf("<h1>Your Form Results:</h1>");

   buf = getenv("QUERY_STRING");

   if(buf == NULL)
      return -1;

   printf("My ");
   int i = 0;
   while(buf[i] != '=')
      printf("%c", buf[i++]);
   printf(" is: ");
   i++;
   while(buf[i] != '&')
      printf("%c", buf[i++]);
   printf("\n\nMy ");
   i++;
   while(buf[i] != '=')
      printf("%c", buf[i++]);
   printf(" is: ");
   i++;
   while(buf[i] != '&')
      printf("%c", buf[i++]);

   printf("\n</body>\n\n</html>");

   return 0;
}

and here's the form I'm using:
Code: Select all
<form action="result.exe">
<input type="text" name="name" /><br />
<input type="text" name="nickname" /><br />
<input type="submit" value="Click!" />
</form>


How do I get XAMPP to treat result.exe as a CGI file?
MyOverflow
 
Posts: 1
Joined: 22. February 2008 11:37

Postby Wiedmann » 22. February 2008 13:58

e.g: Put this exe file in the cgi-bin directory.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 147 guests