Platforms to show: All Mac Windows Linux Cross-Platform
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 query file size
This example is the version from Sun, 4th Jan 2014.
Project "CURLS query file size.xojo_binary_project"
FileTypes
Filetype text
End FileTypes
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
DoDownload
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 ResultText2 Inherits Label
ControlInstance ResultText2 Inherits Label
End Control
Private Sub DoDownload()
dim e as integer
dim d as new DownloadCURL
d.OptionNoBody=true
d.OptionURL=url.text
d.CollectOutputData = true
e=d.Perform
ResultText2.text = "Result: "+str(e)+" and we got this file size: "+str(d.FileSize)+" Bytes"
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 Function Header(data as string) As integer
if left(data,16)="Content-Length: " then
FileSize = val(mid(data,17))
end if
Return lenb(data)
End EventHandler
Property FileSize As Double
End Class
End Project
See also:
- /CURL/CURLS Amazon S3 pre-signed URL
- /CURL/CURLS Amazon S3 upload
- /CURL/CURLS get and put/CURLS get and put
- /CURL/CURLS headers
- /CURL/CURLS info
- /CURL/CURLS Low Level Sockets
- /CURL/CURLS post form values/CURLS post form values
- /CURL/CURLS simple download compressed
- /CURL/CURLS SSL verification/CURLS SSL verification
- /CURL/CURLS text download
The items on this page are in the following plugins: MBS CURL Plugin.