README.md
December 5, 2022 ยท View on GitHub
Description
This isn't much, but it shows you how to use C++ to make CGI programs. NOTE: Please read "Explanations/Assumptions" for instructions on how to use this.
More Info
Compile this code, and start up PWS(Personal Web Server), set the directory permissions to read and execute, put the exe in the directory, then type:
http://localhost/nameofexe.exe
I will add more code later, but I don't have enough time right now...
If the code is successful, it should output "GET" minus the quotes.
| Submitted On | |
| By | Dennis Wrenn |
| Level | Beginner |
| User Rating | 3.5 (14 globes from 4 users) |
| Compatibility | C, C++ (general), Microsoft Visual C++, Borland C++, UNIX C++ |
| Category | Internet/ Browsers/ HTML |
| World | C / C++ |
| Archive File |
Source Code
#include <cstdio>
#include <string>
int main()
{
using namespace std;
char * pcReqMtd;
fprintf(stdout, "Content-type: text/html\n\n");
pcReqMtd = getenv("REQUEST_METHOD");
fprintf(stdout, pcReqMtd);
return 0;
}