Platforms to show: All Mac Windows Linux Cross-Platform

/CURL/CURLS text download web 2.0


Required plugins for this example: MBS CURL Plugin

Last modified Wed, 3rd Jan 2023.

You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /CURL/CURLS text download web 2.0

Download this example: CURLS text download web 2.0.zip

Project "CURLS text download web 2.0.xojo_binary_project"
Class App Inherits WebApplication
EventHandler Sub Opening(args() as String) // add license here End EventHandler
End Class
Class Session Inherits WebSession
End Class
Class MainPage Inherits WebPage
Control Label1 Inherits WebLabel
ControlInstance Label1 Inherits WebLabel
End Control
Control URLField Inherits WebTextField
ControlInstance URLField Inherits WebTextField
End Control
Control DownloadButton Inherits WebButton
ControlInstance DownloadButton Inherits WebButton
EventHandler Sub Pressed() DoDownload URLField.Value End EventHandler
End Control
Control ResultText Inherits WebLabel
ControlInstance ResultText Inherits WebLabel
End Control
Control TextArea1 Inherits WebTextArea
ControlInstance TextArea1 Inherits WebTextArea
End Control
Private Sub DoDownload(URL as string) dim d as new CURLSMBS // collect output as we don't have events to handle it right away d.CollectDebugMessages = true d.CollectOutputData = true d.CollectHeaders = true // write debug log d.OptionVerbose = true // download here d.OptionURL = URL // if you use SSL, maybe put in a certificate or disable verification? d.OptionSSLVerifyHost = 0 d.OptionSSLVerifyPeer = 0 // run download dim e as integer = d.Perform // check result dim s as string = d.OutputData // fix text encoding if s.Encoding <> nil then // ok? elseif encodings.UTF8.IsValidData(s) then s = DefineEncoding(s, Encodings.UTF8) else s = DefineEncoding(s, encodings.ISOLatin1) End If // fix line endings s = ReplaceLineEndings(s, EndOfLine) TextArea1.Value = s ResultText.value = "Result: "+Str(e)+" "+d.LasterrorMessage Dim DebugMessage As String = d.DebugMessages // check in debugger on error if e <> 0 then Break // fix line endings DebugMessage = ReplaceLineEndings(DebugMessage, EndOfLine) TextArea1.Value = DebugMessage End If End Sub
End Class
Sign
End Sign
End Project

See also:

Download this example: CURLS text download web 2.0.zip

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


The biggest plugin in space...