Sample code for 30+ languages & platforms
Visual FoxPro

Download HTML from URL and Convert to XML

See more HTML-to-XML/Text Examples

Downloads an HTML page from a URL and converts it to XML.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loGlob
LOCAL loHttp
LOCAL lcHtml
LOCAL loHtmlToXml
LOCAL lcXml

lnSuccess = 0

* Note: This example requires the Chilkat Bundle license.

* Any string argument automatically begins the 30-day trial.
loGlob = CreateObject('Chilkat.Global')
lnSuccess = loGlob.UnlockBundle("30-day trial")
IF (lnSuccess <> 1) THEN
    ? loGlob.LastErrorText
    RELEASE loGlob
    CANCEL
ENDIF

loHttp = CreateObject('Chilkat.Http')

lcHtml = loHttp.QuickGetStr("http://www.intel.com/")
IF (loHttp.LastMethodSuccess <> 1) THEN
    ? loHttp.LastErrorText
    RELEASE loGlob
    RELEASE loHttp
    CANCEL
ENDIF

loHtmlToXml = CreateObject('Chilkat.HtmlToXml')

* Indicate the charset of the output XML we'll want.
loHtmlToXml.XmlCharset = "utf-8"

* Set the HTML:
loHtmlToXml.Html = lcHtml

* Convert to XML:

lcXml = loHtmlToXml.ToXml()

* Save the XML to a file.
* Make sure your charset here matches the charset
* used for the XmlCharset property.
lnSuccess = loHtmlToXml.WriteStringToFile(lcXml,"qa_output/out.xml","utf-8")

? "Finished."

RELEASE loGlob
RELEASE loHttp
RELEASE loHtmlToXml