(Visual FoxPro) Generate S3 Signed URL
Demonstrates how to generate a pre-signed S3 URL.
LOCAL loHttp
LOCAL lcBucketName
LOCAL lcPath
LOCAL loExpireTime
LOCAL lcSignedUrl
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')
* Insert your access key here:
loHttp.AwsAccessKey = "AWS_ACCESS_KEY"
* Insert your secret key here:
loHttp.AwsSecretKey = "AWS_SECRET_KEY"
lcBucketName = "chilkattest"
lcPath = "starfish.jpg"
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.CkDateTime')
loExpireTime = CreateObject('Chilkat.CkDateTime')
loExpireTime.SetFromCurrentSystemTime()
loExpireTime.AddSeconds(3600)
lcSignedUrl = loHttp.S3_GenerateUrl(lcBucketName,lcPath,loExpireTime)
IF (loHttp.LastMethodSuccess <> 1) THEN
? loHttp.LastErrorText
ELSE
? lcSignedUrl
ENDIF
RELEASE loHttp
RELEASE loExpireTime
|