Sample code for 30+ languages & platforms
Unicode C++

Demonstrate HttpRequest.RemoveAllParams

Demonstrates the effect of calling HttpRequest.RemoveAllParams.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkHttpRequestW.h>

void ChilkatSample(void)
    {
    CkHttpRequestW req;

    req.put_HttpVerb(L"POST");
    req.put_Path(L"/test123");
    req.put_ContentType(L"application/x-www-form-urlencoded");
    req.AddParam(L"paramA",L"AAA");
    req.AddParam(L"paramB",L"BBB");
    req.AddParam(L"paramC",L"CCC");

    wprintf(L"%s\n",req.generateRequestText());
    wprintf(L"---------------\n");

    //  Generates: 

    //  	POST /test123 HTTP/1.1
    //  	Content-Type: application/x-www-form-urlencoded
    //  	Host: domain
    //  	Content-Length: 32
    //  
    //  	paramA=AAA&paramB=BBB&paramC=CCC
    //  

    //  If we call RemoveAllParams, and then add some additional params,
    //  then the original params are gone, and only the new params exist.
    req.RemoveAllParams();
    req.AddParam(L"paramD",L"DDD");
    req.AddParam(L"paramE",L"EEE");
    req.AddParam(L"paramF",L"FFF");
    wprintf(L"%s\n",req.generateRequestText());
    wprintf(L"---------------\n");

    //  Generates:

    //  	POST /test123 HTTP/1.1
    //  	Content-Type: application/x-www-form-urlencoded
    //  	Host: domain
    //  	Content-Length: 32
    //  
    //  	paramD=DDD&paramE=EEE&paramF=FFF
    }