Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Perform a file transfer in background.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
CURL | 2.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example |
---|---|---|
curl | The CURL session handle. | $curl |
Error code. 0 means everything was ok, non-zero means an error occurred.
Run a query in background:
Set Variable [ $json ; Value: Get(ScriptParameter) ]
Set Variable [ $URL ; Value: "https://yourdomain.com/yourscript.php" ]
#
Set Variable [ $curl ; Value: MBS("CURL.New") ]
# configure transfer
Set Variable [ $r ; Value: MBS("CURL.SetOptionURL"; $curl; $URL) ]
Set Variable [ $r ; Value: MBS("CURL.SetOptionPostFields"; $curl; $json) ]
Set Variable [ $r ; Value: MBS("CURL.SetOptionHTTPHeader"; $curl; "Content-Type: application/json") ]
#
# Let the evaluate then free the transfer
# Set Variable [ $r ; Value: MBS("CURL.SetFinishedEvaluate"; $curl; "MBS(\"CURL.Release\"; $$ID$$)" ) ]
# or run a script to handle result
Set Variable [ $r ; Value: MBS("CURL.SetFinishedScript"; $curl; Get(FileName); "Transfer Finished" ) ]
#
# run in background thread asynchronously
Set Variable [ $r ; Value: MBS("CURL.PerformInBackground"; $curl) ]
SendLog(JSON) custom function to send message to log server:
Let([
curl = MBS("CURL.New");
r = MBS("CURL.SetOptionURL"; curl; "https://www.your-domain.com/filemaker/log.php");
r = MBS("CURL.SetOptionHTTPHeader"; curl; "Content-Type: application/json");
r = MBS("CURL.SetOptionPostFields"; curl; json);
// in case of success, just release it.
r = MBS("CURL.SetSucceededEvaluate"; curl; "MBS(\"CURL.Release\"; $$ID$$)" );
// in case of failure, trigger script to log error
r = MBS("CURL.SetFailedScript"; curl; Get(FileName); "Transfer Failed" );
// start sending in background
sent = MBS("CURL.PerformInBackground"; curl)
]; sent)
This function checks for a license.
Created 18th August 2014, last changed 27th December 2023