SQL Server Stored Procedure Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

SQL Server
Stored Procedure Examples

Quick Start
Encryption
File Access
IMAP
POP3
SMTP
Email Object
DKIM / DomainKey
FTP
HTML Conversion
HTTP
MHT
MIME
NTLM
RSA
Diffie-Hellman
DSA
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
String
Tar
Upload
XML
XMP
Zip

Amazon S3
Bz2
CSV
FileAccess
Byte Array
RSS
Atom
Self-Extractor

(SQL Server) HTTP POST text/plain (not URL encoded params)

Demonstrates how to send an HTTP POST with params NOT URL-encoded.

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

    --  Build an HTTP POST Request:
    EXEC sp_OASetProperty @req, 'ContentType', 'text/plain'
    EXEC sp_OASetProperty @req, 'HttpVerb', 'POST'
    EXEC sp_OASetProperty @req, 'Path', '/testPostHandler.asp'
    EXEC sp_OAMethod @req, 'AddParam', NULL, 'arg1', '1.0'
    EXEC sp_OAMethod @req, 'AddParam', NULL, 'arg2', '2.0'
    EXEC sp_OAMethod @req, 'AddParam', NULL, 'arg3', '3.0'

    --  Send the HTTP POST and get the response.
    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 HTML page returned.
        EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT

        PRINT @sTmp0

      END
END
GO

 

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