(AutoIt) S3 Download String Object
Demonstrates how to download a text file (i.e. object) from the Amazon S3 service directly into an in-memory string variable.
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("Chilkat.Http")
; Insert your access key here:
$oHttp.AwsAccessKey = "AWS_ACCESS_KEY"
; Insert your secret key here:
$oHttp.AwsSecretKey = "AWS_SECRET_KEY"
; This bucket is in the us-east-1 region.
$oHttp.AwsRegion = "us-east-1"
Local $sBucketName = "chilkat-test-bucket"
Local $sObjectName = "fruit.xml"
Local $sCharset = "utf-8"
Local $sFileContents
$sFileContents = $oHttp.S3_DownloadString($sBucketName,$sObjectName,$sCharset)
If ($oHttp.LastMethodSuccess <> True) Then
; Failed
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Else
; Success
ConsoleWrite($sFileContents & @CRLF)
EndIf
|