Sample code for 30+ languages & platforms
PowerBuilder

Load XML from a Remote URL

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

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Http
oleobject loo_SbXml
oleobject loo_Xml

li_Success = 0

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

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if
loo_SbXml = create oleobject
li_rc = loo_SbXml.ConnectToNewObject("Chilkat.StringBuilder")

// Download the XML from the URL into sbXml
li_Success = loo_Http.QuickGetSb("https://www.chilkatsoft.com/hamlet.xml",loo_SbXml)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_SbXml
    return
end if

loo_Xml = create oleobject
li_rc = loo_Xml.ConnectToNewObject("Chilkat.Xml")

// Load the XML contained in sbXml
li_Success = loo_Xml.LoadSb(loo_SbXml,1)
if li_Success = 0 then
    Write-Debug loo_Xml.LastErrorText
    destroy loo_Http
    destroy loo_SbXml
    destroy loo_Xml
    return
end if

Write-Debug "Success."


destroy loo_Http
destroy loo_SbXml
destroy loo_Xml