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

Tracing HTTP Redirects

Example to trace through HTTP redirects.

Download Chilkat HTTP ActiveX

LOCAL loHttp
LOCAL lnSuccess
LOCAL lcUrl
LOCAL lcHtml
LOCAL lnStatus
LOCAL lnLoopCount

loHttp = CreateObject('Chilkat.Http')

*  Any string unlocks the component for the 1st 30-days.
lnSuccess = loHttp.UnlockComponent("Anything for 30-day trial")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loHttp.LastErrorText)
    QUIT
ENDIF

lcUrl = "http://www.planyourweddingonline.co.za/"

*  The FollowRedirects property controls whether redirects
*  are automatically followed.  The default behavior is to
*  automatically follow redirects.

*  Explicitly set FollowRedirects so that redirects are NOT automatically taken:
loHttp.FollowRedirects = 0

*  Send the HTTP GET and return the content in a string.
lcHtml = loHttp.QuickGetStr(lcUrl)
IF (lcHtml = NULL ) THEN
    =MESSAGEBOX(loHttp.LastErrorText)
ENDIF

lnStatus = loHttp.LastStatus
? "HTTP Response Status: " + STR(lnStatus)

*  The FinalRedirectUrl property will contain the redirect URL
*  If FollowRedirects was equal to 1, then all of the
*  intermediate redirects (if any) would be followed until
*  there were no more redirects.  However, because
*  FollowRedirects is not 1, FinalRedirectUrl contains
*  the next redirect URL.
? "Redirect URL: " + loHttp.FinalRedirectUrl

lnLoopCount = 0

DO WHILE (lnStatus = 302)
    lcUrl = loHttp.FinalRedirectUrl
    lcHtml = loHttp.QuickGetStr(lcUrl)
    IF (lcHtml = NULL ) THEN
        =MESSAGEBOX(loHttp.LastErrorText)
        EXIT
    ENDIF

    lnStatus = loHttp.LastStatus
    ? "Redirect URL: " + loHttp.FinalRedirectUrl

    *  You may wish to check that if FinalRedirectUrl
    *  equals the URL just retrieved.  If so, then break out of the
    *  loop.  (This check is omitted in this example.)

    *  Instead, this example will prevent infinite loops by
    *  keeping a loopCount and only allows following a max
    *  of 10 redirects:
    lnLoopCount = lnLoopCount + 1
    IF (lnLoopCount > 10) THEN
        EXIT
    ENDIF

ENDDO

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