Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Delphi ActiveXDelphi DLLVisual FoxProJavaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerShellPythonRubySQL ServerUnicode CUnicode C++Visual Basic 6.0VB.NETVBScript

SQL Server Examples

Certificates
Email Object
Encryption
FTP
HTML-to-XML/Text
Gzip
HTTP
IMAP
MHT / HTML Email
PFX/P12
Java KeyStore (JKS)
POP3
RSA Encryption
MIME
SMTP
Socket/SSL/TLS
SSH Key
SSH
SFTP
Tar Archive
XML
XMP
Zip

More Examples...
Amazon S3
Bounced Email
CSV
Diffie-Hellman
DKIM / DomainKey
NTLM

 

 

 

 

 

 

 

XMLHTTP / XMLHttpRequest

Shows how to send an XMLHttpRequest POST and get the response. The body of the HTTP request is an XML document.

Download Chilkat HTTP ActiveX

CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @req int
    EXEC @hr = sp_OACreate 'Chilkat.HttpRequest', @req OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @http int
    EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    --  Any string unlocks the component for the 1st 30-days.
    EXEC sp_OAMethod @http, 'UnlockComponent', @success OUT, 'Anything for 30-day trial'
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        RETURN
      END

    --  Note: You must first replace the domain and path of this example with real values.
    --  There is nothing at http://www.chilkatsoft.com/something.asp

    --  Build an XMLHTTP request.  The XML passed to UseXmlHttp is sent
    --  in the body of the request.
    EXEC sp_OAMethod @req, 'UseXmlHttp', NULL, '<test>This is the XML to be sent</test>'
    EXEC sp_OASetProperty @req, 'Path', '/something.asp'

    --  Send the HTTP POST and get the response.  Note: This is a blocking call.
    --  The method does not return until the full HTTP response is received.
    DECLARE @domain nvarchar(4000)

    DECLARE @port int

    DECLARE @ssl int

    SELECT @domain = 'www.chilkatsoft.com'
    SELECT @port = 80
    SELECT @ssl = 0
    DECLARE @resp int

    EXEC sp_OAMethod @http, 'SynchronousRequest', @resp OUT, @domain, @port, @ssl, @req
    IF @resp Is NULL 
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT

        PRINT @sTmp0
      END
    ELSE
      BEGIN
        --  Display the body of the response.
        EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT

        PRINT @sTmp0
      END


END
GO

 

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