FoxPro Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Visual FoxPro Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
RSA Encryption
S/MIME
Socket
Spider
String
Tar
Upload
XML
XMP
Zip Compression
Self-Extractor

More Examples...
Email Object
POP3
SMTP
RSS
Atom
Byte Array
Service
PPMD
Deflate
DH Key Exchange
DSA

Unreleased...
Bzip2
LZW
Bz2
Icon

 

Non-Chilkat Links
Text and String Handling

Amazon S3 - List Buckets

Demonstrates how to send a GET request to the Amazon S3 service to list buckets.

Download Chilkat Crypt ActiveX

Download Chilkat HTTP ActiveX

LOCAL loHttp
LOCAL lnSuccess
LOCAL lcCurDateTime
LOCAL lcStrToSign
LOCAL loCrypt
LOCAL lcAWSAccessKeyId
LOCAL lcAWSSecretAccessKey
LOCAL lcSignature
LOCAL lcAuthValue
LOCAL lcXmlResponse

loHttp = CreateObject('Chilkat.Http')

lnSuccess = loHttp.UnlockComponent("Anything for 30-day trial.")
IF (lnSuccess <> 1) THEN
    *  Unlock failed.
    =MESSAGEBOX(loHttp.LastErrorText)
    QUIT
ENDIF

*  The HTTP component now includes a method to generate
*  the current date/time in RFC 2616 compliant format.
*  Note: The GenTimeStamp method is available as a pre-release (as of 18-June-2008).
*  It will become available in the next new version dated after
*  18-June-2008.

lcCurDateTime = loHttp.GenTimeStamp()

=MESSAGEBOX(lcCurDateTime)

*  The GET operation on the Service endpoint (s3.amazonaws.com) returns a list of all of the buckets owned by the authenticated sender of the request.

lcStrToSign = "GET" + [CHR(10) + [CHR(10) + [CHR(10) + lcCurDateTime + [CHR(10) + "/"

loCrypt = CreateObject('Chilkat.Crypt2')

lnSuccess = loCrypt.UnlockComponent("Anything for 30-day trial.")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loCrypt.LastErrorText)
    QUIT
ENDIF

*  We want SHA1 for the HMAC hash algorithm:
loCrypt.HashAlgorithm = "sha1"

*  These must be changed for your account:

lcAWSAccessKeyId = "0PN5J17HBGZHT7JJ3X82"

lcAWSSecretAccessKey = "uV3F3YluFJax1cknvbcGwgjvx4QpvB+leU8dUj2o"

*  Set the HMAC secret key:
loCrypt.SetHmacKeyString(lcAWSSecretAccessKey)

*  By setting the charset = "utf-8", the string will be converted
*  to utf-8 (internal to the Chilkat component) prior to signing:
loCrypt.Charset = "utf-8"

*  Indicate that Base64 output is desired:
loCrypt.EncodingMode = "base64"

lcSignature = loCrypt.HmacStringENC(lcStrToSign)

lcAuthValue = "AWS " + lcAWSAccessKeyId + ":" + lcSignature

loHttp.SetRequestHeader("Authorization",lcAuthValue)
loHttp.SetRequestHeader("Date",lcCurDateTime)

lcXmlResponse = loHttp.QuickGetStr("http://s3.amazonaws.com/")
IF (lcXmlResponse = NULL ) THEN
    *  Failed.  Show the last request header, response header,
    *  and response body.
    ? loHttp.LastHeader
    ? "---"
    ? loHttp.LastResponseHeader
    ? "---"
    ? loHttp.LastErrorText
ELSE
    *  Success, show the XML response:
    ? lcXmlResponse
ENDIF

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2007 Chilkat Software, Inc. All Rights Reserved.

Mail Component · .NET Email Component · ASP Mail Component · XML Parser