CGI processing is handled by the cgixx::cgi class. This class processes client headers, including variables and cookies. The get() method is provided for retrieving variable values. Calling get() repeatedly on the same variable name will retrieve all values of that variable.
#include <cgixx/cgixx.h> #include <iostream> #include <string> int main(int argc, char* argv) { cgixx::header header; cgixx::cgi cgi; cgixx::methods method; std::string val; // Print the header std::cout << header.get(); // Get the User Agent header cgi.getheader(cgixx::header_http_user_agent, val); // Print some HTML std::cout << "<HTML><HEAD><TITLE>Test page</TITLE><HEAD>\n" "<BODY><H1>Test Page</H1><HR>\n" "User Agent: " << val << "<br>\n" "Method: "; // Get the CGI Method method = cgi.getmethod(); switch (method) { case cgixx::method_get: std::cout << "Get"; break; case cgixx::method_post: std::cout << "Post"; break; default: std::cout << "unknown"; break; } std::cout << "\n" "</BODY></HTML>" << std::endl; return 0; }