Esempio n. 1
0
int main(int argc, char *argv[]) 
{
    CCgiRequest Request(argc, argv);
    CCgiResponse Response;

    // write out the Content-type header
    Response.WriteHeader();

    // Get the multimap.  see http://www.sgi.com/Technology/STL/Multimap.html
    // on how to manipulate multimaps
    TCgiEntries Entries = Request.GetEntries();

    // this program expects queries of the form cgidemo?name=Fred
    // the following line extracts the "Fred"
    string Name;
    TCgiEntries::const_iterator iName = Entries.find("name");
    if (iName == Entries.end()) Name = "World"; 
    else Name = iName->second;

    // print out the results
    Response.out() << "<html><body>Hello, " << Name;
    Response.out() << "</body></html>" << endl;
    Response.Flush();

    return 0;  
}
Esempio n. 2
0
string s_GetRequestParam(const TCgiEntries &entries,const string &paramName)
{
    string param = "";

    TCgiEntries::const_iterator iter  = entries.find(paramName);
    
    if (iter != entries.end()){
        param = iter->second;        
    }  
    return param;
}