Sample code for 30+ languages & platforms
C++

Example: Http.QuickGetSb method

Demonstrates the QuickGetSb method.

Chilkat C++ Downloads

C++
#include <CkHttp.h>
#include <CkStringBuilder.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkHttp http;

    //  Send the HTTP GET and return the content in a StringBuilder
    CkStringBuilder sb;
    success = http.QuickGetSb("https://www.chilkatsoft.com/helloWorld.json",sb);
    if (http.get_LastMethodSuccess() == false) {
        if (http.get_LastStatus() == 0) {
            //  Communications error.  We did not get a response.
            std::cout << http.lastErrorText() << "\r\n";
        }
        else {
            std::cout << "Response status code: " << http.get_LastStatus() << "\r\n";
            std::cout << "Response body error text:" << "\r\n";
            std::cout << sb.getAsString() << "\r\n";
        }

        return;
    }

    //  The downloaded content:
    std::cout << sb.getAsString() << "\r\n";
    std::cout << "Success" << "\r\n";
    }