Sample code for 30+ languages & platforms
Xbase++

S3 Download String Object

See more Amazon S3 Examples

Demonstrates how to download a text file (i.e. object) from the Amazon S3 service directly into an in-memory string variable.

Chilkat Xbase++ Downloads

Xbase++
LOCAL oHttp
LOCAL cBucketName
LOCAL cObjectName
LOCAL cCharset
LOCAL cFileContents

//  This example assumes the Chilkat API to have been previously unlocked.
//  See Global Unlock Sample for sample code.

oHttp := CreateObject("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"

cBucketName := "chilkat-test-bucket"

cObjectName := "fruit.xml"

cCharset := "utf-8"

cFileContents := oHttp:S3_DownloadString(cBucketName, cObjectName, cCharset)

IF (oHttp:LastMethodSuccess != 1)
    //  Failed
    ? oHttp:LastErrorText
ELSE
    //  Success
    ? cFileContents
ENDIF

oHttp:destroy()