Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5   8.0   8.1    Statistic  


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

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
CURL 5.2 Yes Yes Yes Yes Yes

MBS( "CURL.GetResultAsContainer"; Handle { ; Filename; PluginDetect } )


Parameter Description Example value
Handle The CURL session handle. $curl
Filename Optional
The desired file name
PluginDetect Optional
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.


Returns OK 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.


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.GetDebugAsText"; $curl)]
# cleanup
Set Variable [$r; Value:MBS("CURL.Cleanup"; $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.GetDebugAsText"; $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.Destroy";$ImageRef) ]
    End If
End If
Set Variable [ $r ; Value: MBS("CURL.Cleanup"; $curl) ]

See also

Example Databases

CURL.GetResponseCode   -   CURL.GetResultAsData

Feedback: Report problem or ask question.

MBS FileMaker blog