bBox_Curl
bBox_Curl( param1 {; ...} ) Parameters: param1: first curl parameter (required) param2: curl parameter (optional) … {zero or more parameters} Result: curl output (from stdout) Error: bBox_LastError ("curl") Script Step: bBox Curl [ Param1; Param2; Param3; Param4; Param5; Param6; Param7 ]
––––––––––
First appeared in: 0.40
Examples in demo file: 32
Compatibility: Client, macOS, Server, Ubuntu, WebDirect, WPE
––––––––––
Return the results of the curl command with the given parameters. Each FileMaker parameter is equivalent to one curl parameter.
Certain output, e.g., download progress information, will end up in the system log (/var/log/system.log) on macOS, or the fmshelper.log on Ubuntu, so you may want to suppress this with the “-s” option. Also, -v output is sent to stderr (not stdout) by Curl, so use one of Curl’s --trace options to direct output to a file instead, or add 32 to mode to combine stdout & stderr output.
The curl command is sensitive to spaces after an option. For instance, you might do the following in a shell script:
curl -o /var/tmp/www.beezwax.net.html http://beezwax.net
However, with the bBox_Curl function there is no shell to strip out extra spaces, so the above example should be written as:
bBox_Curl ("-o/var/tmp/www.beezwax.net.html"; "http://beezwax.net")
Additionally, there is typically no need to use quotes around most parameters as you would in the shell. However, you may need to use FileMaker's GetAsURLEncoded function in some cases.
If using the longer form of Curl option name, the name must be in its own FileMaker parameter, so the same request becomes:
bBox_Curl ("--output", "/var/tmp/www.beezwax.net.html"; "http://beezwax.net")
This function supports container field references. Below we'll use that feature to send some text from the file in the DATA::file container field:
bBox_Curl (
"--mail-from"; "brown@domain.com";
"--mail-rcpt"; "simon@domain.com";
"--upload-file"; DATA::FILE;
"smtp://mail.domain.com"
)
––––––––––