Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
|
(SQL Server) Persist Cookies to XML Files and Auto Re-SendDemonstrates how to persist incoming cookies to XML files and automatically re-send in subsesquent HTTP requests. CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @sTmp0 nvarchar(4000)
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
-- To save cookies to XML files (per domain) in a specific
-- directory, set the CookieDir property (the directory must
-- already exist and be writeable by the caller). Also,
-- set the SaveCookies property:
EXEC sp_OASetProperty @http, 'CookieDir', '/cookieDir'
EXEC sp_OASetProperty @http, 'SaveCookies', 1
-- Any methods that do a GET, POST, etc. will save cookies
-- to the CookieDir:
DECLARE @html nvarchar(4000)
EXEC sp_OAMethod @http, 'QuickGetStr', @html OUT, 'https://www.paypal.com/'
-- After running this code, a "paypal_com.xml" file should appear
-- in /cookieDir.
-- It's content will look something like this:
--
|
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.