FoxPro Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Visual FoxPro Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
RSA
S/MIME
Socket
Spider
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
String
Tar
Upload
XML
XMP
Zip Compression
Self-Extractor

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

Unreleased...
FileAccess
Bzip2
LZW
Icon

 

Non-Chilkat Links
Text and String Handling

Amazon S3 - Create Bucket with Constraint

Create an Amazon S3 bucket with a constraint using the REST API.

Download Chilkat XML ActiveX

Download Chilkat Crypt ActiveX

Download Chilkat HTTP ActiveX

LOCAL loHttp
LOCAL lnSuccess
LOCAL loXml
LOCAL loCrypt
LOCAL lcCurDateTime
LOCAL lcStrToSign
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

*  Create the XML contraint for the bucket:
*  <CreateBucketConfiguration>
*          <LocationConstraint>EU</LocationConstraint>
*  </CreateBucketConfiguration>
loXml = CreateObject('Chilkat.Xml')
loXml.Tag = "CreateBucketConfiguration"
loXml.NewChild2("LocationConstraint","EU")
? loXml.GetXml()

loCrypt = CreateObject('Chilkat.Crypt2')

lnSuccess = loCrypt.UnlockComponent("Anything for 30-day trial.")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loCrypt.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()

*  The PUT request operation with a bucket URI creates a new bucket.

lcStrToSign = "PUT" + [CHR(10) + [CHR(10) + "text/xml" + [CHR(10) + lcCurDateTime + [CHR(10) + "/chilkat2/"

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

*  These must be changed for your account:

lcAWSAccessKeyId = "zzzzzzzzzzzzzzzzzzzz"

lcAWSSecretAccessKey = "zzzzzzzzzzzzzzzzzzzzzzzzzz"

*  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

*  The bucket to be created is specified in the Host header.
*  In this example, the "chilkat2" bucket is created:
loHttp.SetRequestHeader("Host","chilkat2.s3.amazonaws.com")

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

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

    *  Success is indicated by an empty xmlResponse string, and
    *  a response status of 200.
    IF (loHttp.LastStatus = 200) THEN
        =MESSAGEBOX("Bucket created!")

        *  Let's check out the response header anyway...
        ? loHttp.LastResponseHeader

    ELSE
        ? "LastStatus: " + loHttp.LastStatus
        ? "---"
        *  Failed.  Show the last request header, response header,
        *  and response body.
        ? loHttp.LastHeader
        ? "---"
        ? loHttp.LastResponseHeader
        ? "---"
        ? loHttp.LastErrorText
    ENDIF

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