Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


Returns the result of the transaction as container value with auto detection of type.

Component Version macOS Windows Linux Server iOS SDK
CURL 5.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "CURL.GetResultAsContainer"; curl { ; Filename; PluginDetect } )   More


Parameter Description Example Flags
curl The CURL session handle. $curl
Filename The desired file name.
Since 13.3 only used if download has no file name.
test.jpg Optional
PluginDetect If 1 the plugin will do the file type detection. If not provided or 0 and the FileMaker version is 13.0 or newer, the FileMaker engine will decide on the type. Optional


Returns container value or error.


Returns the result of the transaction as container value with auto detection of type.
The plugin will detect the type of data based on the file extension.
If no filename is provided, the plugin uses the filename from the URL.

For PDF content: If you have a DynaPDF Pro license and DynaPDF functions initialized, this function can add previews for the PDF file on Windows and Linux. For MacOS, we make them with PDFKit.

For HEIF/HEIC images, please use Container.ReadImage to convert the image.


Load JPEG from URL to container:

# start new transfer
Set Variable [$curl; Value:MBS("CURL.New")]
# set URL
Set Variable [$r; Value:MBS("CURL.SetOptionURL"; $curl; "")]
# run transfer
Set Variable [$ErrorCode; Value:MBS("CURL.Perform"; $curl)]
# get result as JPG and store in field:
Set Variable [$Result; Value:MBS( "CURL.GetResultAsContainer"; $curl)]
Set Field [test::MyContainerField; $Result]
# get debug messages:
Set Variable [$DebugMessages; Value:MBS( "CURL.GetDebugMessages"; $curl)]
# cleanup
Set Variable [$r; Value:MBS("CURL.Release"; $curl)]

Download picture and scale it down:

Set Variable [ $curl ; Value: MBS("CURL.New") ]
Set Variable [ $r ; Value: MBS("CURL.SetOptionURL"; $curl; MIX::URL) ]
Set Variable [ $r ; Value: MBS("CURL.SetOptionFollowLocation"; $curl; 1) ]
Set Variable [ $r ; Value: MBS("CURL.SetOptionMaxRedirs"; $curl; 3) ]
Set Variable [ $result ; Value: MBS("CURL.Perform"; $curl) ]
Set Variable [ $debug ; Value: MBS( "CURL.GetDebugMessages"; $curl) ]
If [ $result = "OK" ]
    Set Variable [ $Image ; Value: MBS( "CURL.GetResultAsContainer"; $curl) ]
    Set Variable [ $ImageRef ; Value: MBS("GMImage.NewFromContainer"; $image) ]
    If [ MBS("IsError") = 0 ]
        Set Variable [ $r ; Value: MBS("GMImage.Scale";$ImageRef; "256x256>") ]
        Set Variable [ $ScaledImage ; Value: MBS("GMImage.WriteToJPEGContainer"; $ImageRef) ]
        If [ MBS("IsError") = 0 ]
            Set Field [ MIX::Image ; $ScaledImage ]
        End If
        Set Variable [ $r ; Value: MBS("GMImage.Release";$ImageRef) ]
    End If
End If
Set Variable [ $r ; Value: MBS("CURL.Release"; $curl) ]

Get file name for container from header:

Set Variable [ $name ; Value: "" ]
Set Variable [ $headers ; Value: MBS( "CURL.GetHeaders”; $curl; "UTF-8") ]
Set Variable [ $headers ; Value: MBS( "List.MatchesPrefix"; $headers; "Content-Disposition: attachment; filename=") ]
If [ Length($headers) > 0 ]
    Set Variable [ $name ; Value: Middle ( $headers ; 43 ; Length($headers) ) ]
End If
Set Field [ CURL Test::File ; MBS("CURL.GetResultAsContainer"; $curl; $name) ]

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 15th June 2015, last changed 8th July 2023

CURL.GetResponseCode - CURL.GetResultAsData