curl-library
Handling cookies with libcurl and VB
Date: Thu, 26 May 2005 13:55:52 +0200
Hi everybody and sorry for the lame question, but I am unable to store
my cookies on a file for later use.
I know I have to set the CURLOPT_COOKIEJAR option, and that worked
fine when I used the Delphi binding, but now I am not able to make it
work again in VB.
Here is how I modified the provided SSLGet example (basically I only
added the CURLOPT_COOKIEJAR directive together with
CURLOPT_SSL_VERIFYPEER=0)
Thank you in advance for any tip.
-.-.-.-.-.-.-.-.-.-.-.-
Private Sub Test()
SSLGet "https://siatel.finanze.it"
End Sub
Private Sub SSLGet(url As String)
Dim context As Long
Dim ret As Long
Dim buf As New Buffer
context = vbcurl_easy_init()
vbcurl_easy_setopt context, CURLOPT_URL, url
vbcurl_easy_setopt context, CURLOPT_CAINFO, caFile
vbcurl_easy_setopt context, CURLOPT_WRITEFUNCTION, _
AddressOf WriteFunction
vbcurl_easy_setopt context, CURLOPT_WRITEDATA, ObjPtr(buf)
vbcurl_easy_setopt context, CURLOPT_NOPROGRESS, 0
vbcurl_easy_setopt context, CURLOPT_PROGRESSFUNCTION, _
AddressOf ProgressFunction
'vbcurl_easy_setopt context, CURLOPT_SSL_CTX_FUNCTION, _
' AddressOf SSLContextFunction
vbcurl_easy_setopt context, CURLOPT_SSL_VERIFYPEER, 0
vbcurl_easy_setopt context, CURLOPT_COOKIEJAR, "C:\temp\cookie.txt"
ret = vbcurl_easy_perform(context)
vbcurl_easy_cleanup context
Debug.Print "Here's the SSL HTML:"
Debug.Print buf.stringData
End Sub
-- Ciao NicoReceived on 2005-05-26