Sample code for 30+ languages & platforms
Lianja

Load XML from a Remote URL

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

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

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

loHttp = createobject("CkHttp")
loSbXml = createobject("CkStringBuilder")

// Download the XML from the URL into sbXml
llSuccess = loHttp.QuickGetSb("https://www.chilkatsoft.com/hamlet.xml",loSbXml)
if (llSuccess = .F.) then
    ? loHttp.LastErrorText
    release loHttp
    release loSbXml
    return
endif

loXml = createobject("CkXml")

// Load the XML contained in sbXml
llSuccess = loXml.LoadSb(loSbXml,.T.)
if (llSuccess = .F.) then
    ? loXml.LastErrorText
    release loHttp
    release loSbXml
    release loXml
    return
endif

? "Success."


release loHttp
release loSbXml
release loXml