You find this example project in your Plugins Download as a Xojo project file within the examples folder: /CURL/CURLS Amazon S3 pre-signed URL
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
DoDownload
End EventHandler
End Control
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
End Control
Control ResultText Inherits Label
ControlInstance ResultText Inherits Label
End Control
Function CreatePresignedURL() As String
Dim URL As String
// please put your own data here
Const AWSAccessKeyId = "AKIAXYQWFBIBSX2I6GEA"
Const AWSSecretAccessKey = "cE5ctB8xXOG3V7F3zoq1W2gg8x52f7r4y7H5ei03"
Const Region = "eu-central-1"
Const Service = "s3"
Const Path = "/monkeybreadsoftware/test.jpg"
Const Domain = "" // auto
Const Verb = "GET"
Const Expires = 86400
URL = CURLSMBS.AWSPresignURL(AWSAccessKeyId, AWSSecretAccessKey, Region, Service, Path, Domain, Verb, Expires)
return URL
End Function
Private Sub DoDownload()
// usually you create the URL
Dim URL As String = CreatePresignedURL
dim e as integer
dim d as new CURLSMBS
d.OptionVerbose = true
// if you use SSL, maybe put in a certificate or disable verification?
d.OptionSSLVerifyHost = 0
d.OptionSSLVerifyPeer = 0
d.OptionURL = URL
e=d.Perform
// pick image from output data
Canvas1.Backdrop = picture.FromData(d.OutputData) // from JPEG plugin
ResultText.text="Result: "+str(e) // on success
dim DebugMessage as string = d.DebugMessages // check in debugger on error
dim OutputData as string = d.OutputData
dim HTTPResult as integer = d.GetInfoResponseCode
if e <> 0 and HTTPResult <> 200 then
break
end if
End Sub
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu5 = ""
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
MenuItem UntitledMenu4 = ""
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = ""
End MenuBar
Class App Inherits Application
End Class