![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Visual FoxPro) Example: Http.QuickGet methodDemonstrates the
LOCAL lnSuccess LOCAL loHttp LOCAL loZipBytes LOCAL loZip LOCAL loEntry LOCAL lnLineEndingBehavior LOCAL lcXmlStr LOCAL loSb lnSuccess = 0 * This example requires the Chilkat API to have been previously unlocked. * See Global Unlock Sample for sample code. loHttp = CreateObject('Chilkat.Http') loHttp.KeepResponseBody = 1 * This URL is valid and can be tested... loZipBytes = loHttp.QuickGet("https://chilkatdownload.com/example_data/hamlet.zip") IF (loHttp.LastMethodSuccess = 0) THEN ? loHttp.LastErrorText RELEASE loHttp CANCEL ENDIF IF (loHttp.LastStatus <> 200) THEN ? "Response status code: " + STR(loHttp.LastStatus) ? loHttp.LastResponseBody RELEASE loHttp CANCEL ENDIF loZip = CreateObject('Chilkat.Zip') * Open the zip from the bytes contained in bd. lnSuccess = loZip.OpenFromMemory(loZipBytes) IF (lnSuccess = 0) THEN ? loZip.LastErrorText RELEASE loHttp RELEASE loZip CANCEL ENDIF * Get the entry for the file we want.. loEntry = CreateObject('Chilkat.ZipEntry') lnSuccess = loZip.EntryOf("hamlet.xml",loEntry) IF (lnSuccess = 0) THEN ? loZip.LastErrorText RELEASE loHttp RELEASE loZip RELEASE loEntry CANCEL ENDIF * Convert all line endings to CRLF (if needed) lnLineEndingBehavior = 2 lcXmlStr = loEntry.UnzipToString(lnLineEndingBehavior,"utf-8") IF (loEntry.LastMethodSuccess = 0) THEN ? loEntry.LastErrorText RELEASE loHttp RELEASE loZip RELEASE loEntry CANCEL ENDIF * The XML in this case is about 274K, so let's just examine the last 20 lines... loSb = CreateObject('Chilkat.StringBuilder') loSb.Append(lcXmlStr) ? loSb.LastNLines(20,1) RELEASE loHttp RELEASE loZip RELEASE loEntry RELEASE loSb |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.