Topics   All   Mac OS X (Only)   Windows (Only)   Crossplatform   Server (Not)   Client   Components   Old   Guides
New in version: 4.0   4.1   4.2   4.3   4.4   5.0   5.1   5.2   5.3   5.4   6.0   6.1   6.2   6.3    Statistic  

CURL.Cleanup

Component: CURL
Version: 2.5
Mac OS X: Yes
Windows: Yes
Server: Yes

MBS( "CURL.Cleanup"; Handle )

Parameters

Parameter Description Example value
Handle The CURL session handle. $curl

Result

Returns "OK" on success or error on failure.

Description

End a CURL session.
This function must be the last function to call for a CURL session. It is the opposite of the CURL.New function and must be called with the same handle as input that the CURL.New call returned.
This will effectively close all connections this handle has used and possibly has kept open until now. Don't call this function if you intend to transfer more files.
Any uses of the handle after this function has been called and have returned, are illegal. This kills the handle and all memory associated with it!
Please don't try to close a running transfer.

Examples

Cleanup session:

# for every New call
$curl = MBS( "CURL.New")
# you need a cleanup call
MBS( "CURL.Cleanup"; $curl )

Download URL to temp file:

Set Variable [$curl; Value:MBS("CURL.New")]
#this is URL to download
Set Variable [$url; Value:"http://www.monkeybreadsoftware.de/filemaker/test.txt"]
#get file name from URL
Set Variable [$name; Value:MBS( "Path.LastPathComponent"; $URL )]
#now make temp file path
Set Variable [$path; Value:MBS( "Path.AddPathComponent"; MBS( "Folders.SystemTemporary" ); $name )]
#set URL to download
Set Variable [$r; Value:MBS("CURL.SetOptionURL"; $curl; "http://www.monkeybreadsoftware.de/filemaker/test.txt")]
#open destination file
Set Variable [$r; Value:MBS("CURL.CreateOutputFile"; $curl; $path)]
#run transfer
Set Field [CURL Test::Result; MBS("CURL.Perform"; $curl)]
#close destination file
Set Variable [$r; Value:MBS("CURL.CloseOutputFile"; $curl)]
#get debug messages
Set Field [CURL Test::debug; MBS("CURL.GetDebugAsText"; $curl)]
Set Variable [$result; Value:MBS("CURL.Cleanup"; $curl)]

See also


CURL.Check   -   CURL.CloseDebugFile

Feedback: Report problem or ask question.




Links
MBS REAL studio Plugins - Nachhilfe in Kruft