Skip to content

HTTP Cookies Example

Andrew Lambert edited this page May 9, 2016 · 23 revisions

work in progress.

libcURL implements an optional cookie management system (the "Cookie Engine") which works much like that in a web browser: automatically collecting cookies when they are received and then sending them back when appropriate. The CookieEngine class is the primary means of managing cookies collected by libcURL; you will almost never have cause to manually set cookie headers.

##Set a cookie

Dim curl As New cURLClient
Call curl.SetCookie("foo", "bar", ".example.com") ' set a cookie
If curl.Get("http://www.example.com/") Then
  Dim page As String = curl.GetDownloadedData()
Else
  MsgBox(libcURL.FormatError(curl.LastError))
End If

##Read a cookie

Dim curl As New cURLClient
If curl.Get("http://www.example.com/") Then
  Dim cookievalue As String = curl.GetCooElse
  MsgBox(libcURL.FormatError(curl.LastError))
End If
Clone this wiki locally