Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/CURL/CURLS simple download compressed
Function:
Required plugins for this example: MBS CURL Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /CURL/CURLS simple download compressed
This example is the version from Sun, 4th Jan 2014.
Project "CURLS simple download compressed.rbp"
FileTypes
Filetype text
End FileTypes
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() DoDownload url.text End EventHandler
End Control
Control URL Inherits TextField
ControlInstance URL Inherits TextField
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control ResultText Inherits Label
ControlInstance ResultText Inherits Label
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Private Sub DoDownload(URL as string) dim e as integer dim d as DownloadCURL d=new DownloadCURL d.OptionURL = URL d.OptionVerbose = true d.CollectOutputData = true // enable compression with gzip d.OptionAcceptEncoding = "gzip" // gzip, deflate or identity // for SSL allow all hosts and peers (no security!) d.OptionSSLVerifyPeer = 0 d.OptionSSLVerifyHost = 0 e=d.Perform // if GetInfoSizeDownload is smaller than downloaded data, we have compression! list.Addrow "Result: "+str(e, "-0") List.AddRow "Data downloaded: "+str(lenb(d.OutputData), "-0") List.AddRow "GetInfoSizeDownload: "+str(d.GetInfoSizeDownload, "-0") List.AddRow "GetInfoContentLengthDownload: "+str(d.GetInfoContentLengthDownload, "-0") End Sub
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
Class DownloadCURL Inherits CURLSMBS
EventHandler Sub DebugMessage(infotype as integer, data as string) t.WriteLine data End EventHandler
EventHandler Function Progress(dltotal as double, dlnow as double, ultotal as double, ulnow as double) As boolean if dltotal=0 then window1.ResultText.text="Downloading..." else window1.ResultText.text="Downloading "+Format(dlnow/dltotal,"0%") end if Return false End EventHandler
Sub Constructor() dim f as FolderItem = SpecialFolder.Desktop.Child("log.txt") t = TextOutputStream.Create(f) End Sub
Property b As BinaryStream
Property t As TextOutputStream
End Class
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS CURL Plugin.




Links
MBS Xojo Chart Plugins