emsApplication/applications/WebConfigure/example/cgiDemo/cgi-post.cpp

67 lines
1.7 KiB
C++
Raw Permalink Normal View History

2024-05-24 12:19:45 +08:00
#include <iostream>
#include <cgicc/CgiDefs.h>
#include <cgicc/Cgicc.h>
#include <cgicc/HTTPHTMLHeader.h>
#include <cgicc/HTMLClasses.h>
using namespace cgicc;
int main ()
{
using namespace std;
cout << ("Content-type: text/html;charset=utf-8\n\n") << endl;
cout << "hello World!" << endl;
#if 0
Cgicc formData;
// Output the HTTP headers for an HTML document, and the HTML 4.0 DTD info
//cout << HTTPHTMLHeader() << HTMLDoctype(HTMLDoctype::eStrict) << endl;
cout << html().set("lang", "en").set("dir", "ltr") << endl;
// Set up the page's header and title.
cout << head() << endl;
cout << title() << "GNU cgicc v" << formData.getVersion() << title() << endl;
cout << head() << endl;
cout << body() << endl;
//std::cout << "Content-type:text/html;charset=utf-8\r\n\r\n";
// Start the HTML body
// Start the HTML body
//std::cout << "<!DOCTYPE html>\n";
//std::cout << "<title>使用 GET 传递参数</title>\n";
form_iterator fi = formData.getElement("spm");
if( !fi->isEmpty() && fi != (*formData).end())
{
std::cout << "spm:" << **fi << std::endl;
}
std::cout << "<br/>\n";
fi = formData.getElement("id");
if( !fi->isEmpty() && fi != (*formData).end())
{
std::cout << "id:" << **fi << std::endl;
}
std::cout << "<br/>\n";
fi = formData.getElement("cm_id");
if( !fi->isEmpty() && fi != (*formData).end())
{
std::cout << "cm_id:" << **fi << std::endl;
}
std::cout << "<br/>\n";
fi = formData.getElement("abbucket");
if( !fi->isEmpty() && fi != (*formData).end())
{
std::cout << "abbucket:" << **fi << std::endl;
}
#endif
return 0;
}