Sample code for 30+ languages & platforms
C++

Load XML from a Remote URL

Demonstrates how to load XML from a remote URL, such as https://www.chilkatsoft.com/hamlet.xml

Chilkat C++ Downloads

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

void ChilkatSample(void)
    {
    bool success = false;

    //  This example assumes the Chilkat HTTP API to have been previously unlocked.
    //  See Global Unlock Sample for sample code.

    CkHttp http;
    CkStringBuilder sbXml;

    //  Download the XML from the URL into sbXml
    success = http.QuickGetSb("https://www.chilkatsoft.com/hamlet.xml",sbXml);
    if (success == false) {
        std::cout << http.lastErrorText() << "\r\n";
        return;
    }

    CkXml xml;

    //  Load the XML contained in sbXml
    success = xml.LoadSb(sbXml,true);
    if (success == false) {
        std::cout << xml.lastErrorText() << "\r\n";
        return;
    }

    std::cout << "Success." << "\r\n";
    }