Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
CURL.GetCookieList
Get list of all cookies cURL known (expired ones, too).
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
CURL | 2.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
curl | The CURL session handle. | $curl |
Result
Returns the requested value or nothing on error.
Description
Get list of all cookies cURL known (expired ones, too).If there are no cookies (cookies for the handle have not been enabled or simply none have been received), the list is just an empty string.
Examples
Perform SOAP service with login and use cookies in second request:
# The URL of the service
Set Variable [ $url ; Value: "http://somedomain.com/PartnerService17.asmx" ]
# Build XML for SOAP Login request, e.g. with MBS XML functions or simply subsitute()
Set Variable [ $xml ; Value: "<?xml version=\"1.0\" encoding=\"utf-8\"?> <soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"> <soap:Body> </soap:Body> …" ]
Set Field [ Curl_Test::XML ; $xml ]
# The SOAP action to use
Set Variable [ $action ; Value: "http://somedomain.com/partner/loginWithLicenceUnlockInfo" ]
#
# Setup transfer
Set Variable [ $curl ; Value: MBS("CURL.New") ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionURL"; $curl; $url) ]
# Put SOAP action and XML data type in the headers
Set Variable [ $result ; Value: MBS("CURL.SetOptionHTTPHeader"; $curl; "Content-Type: text/xml; charset=utf-8"; "Expect:"; "SOAPAction: \""& $action & "\"") ]
# Ask CURL to manage cookies
Set Variable [ $result ; Value: MBS("CURL.SetOptionCookieFile"; $curl; "" ) ]
# Set the payload for the login transfer
Set Variable [ $result ; Value: MBS("CURL.SetOptionPostFields"; $curl; $xml) ]
# Run transfer
Set Variable [ $result ; Value: MBS("CURL.Perform"; $curl) ]
# Let's take a look on the cookie list
Set Variable [ $$cookie ; Value: MBS("CURL.GetCookieList"; $curl ) ]
Set Field [ Curl_Test::Cookie ; $$cookie ]
# Check result
Set Field [ Curl_Test::Debug ; MBS("CURL.GetDebugMessages"; $curl) ]
Set Variable [ $result ; Value: MBS("CURL.GetResultAsText"; $curl) ]
Set Field [ Curl_Test::Resultat ; $result ]
#
# Reuse same $curl for second request reusing existing cookies
#
# Make new XML for second request
Set Variable [ $npk ; Value: "103" ]
# Build XML for SOAP Login request, e.g. with MBS XML functions or simply subsitute()
Set Variable [ $xml ; Value: "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"> <soap:Body> </soap:Body> </soap:Envelope>" ]
Set Field [ Curl_Test::XML ; $xml ]
Set Variable [ $action ; Value: "http://somedomain.com/partner/queryInfo" ]
#
# Setup transfer
Set Variable [ $result ; Value: MBS("CURL.SetOptionURL"; $curl; $url) ]
# Put SOAP action and XML data type in the headers
Set Variable [ $result ; Value: MBS("CURL.SetOptionHTTPHeader"; $curl; "Content-Type: text/xml; charset=utf-8"; "Expect:"; "SOAPAction: \""& $action & "\"") ]
# Set the payload for the second transfer
Set Variable [ $result ; Value: MBS("CURL.SetOptionPostFields"; $curl; $xml) ]
# Run transfer
Set Variable [ $result ; Value: MBS("CURL.Perform"; $curl) ]
# Check result
Set Field [ Curl_Test::Debug ; MBS("CURL.GetDebugMessages"; $curl) ]
Set Variable [ $result ; Value: MBS("CURL.GetResultAsText"; $curl) ]
Set Field [ Curl_Test::Resultat ; $result ]
# Finally end curl session
Set Variable [ $r ; Value: MBS("CURL.Release"; $curl) ]
See also
- CURL.GetDebugMessages
- CURL.GetResultAsText
- CURL.Perform
- CURL.Release
- CURL.SetOptionCookie
- CURL.SetOptionCookieFile
- CURL.SetOptionHTTPHeader
- CURL.SetOptionPost
- CURL.SetOptionPostFields
- CURL.SetOptionURL
Example Databases
Blog Entries
This function checks for a license.
Created 18th August 2014, last changed 19th April 2020