Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 8.0   8.1   8.2   8.3   8.4   8.5   9.0   9.1   9.2   9.3    Statistic  

CURL.GetCookieList

Get list of all cookies cURL known (expired ones, too).

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
CURL 2.5 Yes Yes Yes Yes Yes
MBS( "CURL.GetCookieList"; curl )   More

Parameters

Parameter Description Example value
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.GetDebugAsText"; $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.GetDebugAsText"; $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.Cleanup"; $curl) ]

See also

Example Databases

Blog Entries

Created 18th August 2014, last changed 28th February 2019


CURL.GetContentType   -   CURL.GetDebugAsText

Feedback: Report problem or ask question.




Links
MBS Xojo blog