Sample code for 30+ languages & platforms
Visual FoxPro

Load XML from a Remote URL

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

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loHttp
LOCAL loSbXml
LOCAL loXml

lnSuccess = 0

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

loHttp = CreateObject('Chilkat.Http')
loSbXml = CreateObject('Chilkat.StringBuilder')

* Download the XML from the URL into sbXml
lnSuccess = loHttp.QuickGetSb("https://www.chilkatsoft.com/hamlet.xml",loSbXml)
IF (lnSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loSbXml
    CANCEL
ENDIF

loXml = CreateObject('Chilkat.Xml')

* Load the XML contained in sbXml
lnSuccess = loXml.LoadSb(loSbXml,1)
IF (lnSuccess = 0) THEN
    ? loXml.LastErrorText
    RELEASE loHttp
    RELEASE loSbXml
    RELEASE loXml
    CANCEL
ENDIF

? "Success."

RELEASE loHttp
RELEASE loSbXml
RELEASE loXml