Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
11.1
11.2
11.3
11.4
11.5
12.0
12.1
12.2
12.3
12.4
Statistic
FMM
Blog
CURL.GetResultAsText
Returns the result of the transaction as text.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
CURL | 2.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
curl | The CURL session handle. | $curl | |
Encoding | The text encoding for result. Default is native. This function can also handle UTF-16 as well as UTF-16LE and UTF-16BE for little/big endian byte order. Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ. |
"UTF-8" | Optional |
preserveLineEndings | Whether to change line endings to CR for FileMaker. By default (0) we change the line endings to CR, so FileMaker has no trouble. Pass 1 to keep whatever line endings are there. |
0 | Optional |
Result
The result as text.
Description
Returns the result of the transaction as text.You are responsible for detecting decoding.
See also CURL.GetResultAsContainer.
Plugin version 5.2 and newer replace newlines automatically for you to match what FileMaker uses (Mac line endings).
Examples
Query result as UTF-8 text:
MBS("CURL.GetResultAsText"; $curl; "UTF-8")
Query result as Windows Ansi encoding:
MBS("CURL.GetResultAsText"; $curl; "windows")
Get result text and convert line endings for FileMaker:
MBS("Text.ReplaceNewline"; MBS("CURL.GetResultAsText"; $curl);1)
Download some text:
Set Variable [$curl; Value:MBS("CURL.New")]
Set Variable [$result; Value:MBS("CURL.SetOptionURL"; $curl; CURL Test::URL)]
Set Field [CURL Test::Result; MBS("CURL.Perform"; $curl)]
Set Field [CURL Test::Text; MBS("CURL.GetResultAsText"; $curl; "UTF8")]
Set Variable [$result; Value:MBS("CURL.Release"; $curl)]
Download a text from URL:
# start new transfer
Set Variable [$curl; Value:MBS("CURL.New")]
# set URL
Set Variable [$r; Value:MBS("CURL.SetOptionURL"; $curl; "https://www.mbsplugins.eu/")]
# run transfer
Set Variable [$ErrorCode; Value:MBS("CURL.Perform"; $curl)]
# get result as text and debug messages:
Set Variable [$TextResult; Value:MBS( "CURL.GetResultAsText"; $curl)]
Set Variable [$DebugMessages; Value:MBS( "CURL.GetDebugAsText"; $curl)]
# cleanup
Set Variable [$r; Value:MBS("CURL.Release"; $curl)]
Query webservice with JSON request:
Set Variable [$curl; Value:MBS("CURL.New")]
Set Variable [$result; Value:MBS("CURL.SetOptionURL"; $curl; "http://test.test/ws/v1/catalogo/getmodelos")]
#pass JSON for query
Set Variable [$result; Value:MBS("CURL.SetOptionPostFields"; $curl; "{\"brandId\" : \"1\", \"device\" : \"70\"}"; "UTF-8")]
Set Field [models::result; MBS("CURL.Perform"; $curl)]
Set Field [models::text; MBS("CURL.GetResultAsText"; $curl;"UTF8")]
Set Field [models::header; MBS("CURL.GetDebugAsText"; $curl)]
Set Variable [$result; Value:MBS("CURL.Release"; $curl)]
See also
- CURL.GetDebugAsText
- CURL.GetHeaderAsText
- CURL.GetResultAsData
- CURL.GetResultAsJPEG
- CURL.GetResultAsPDF
- CURL.GetResultAsPNG
- CURL.SetupOAuth
- CURL.UseSystemCertificates
- JSON.Parse
- Text.ReplaceNewline
Release notes
- Version 12.3
- Fixed a possible race condition for CURL.GetResultAsText and similar.
- Version 9.3
- Added preserveLineEndings parameter for CURL.GetDebugAsText, CURL.GetHeaderAsText, CURL.GetInputAsText and CURL.GetResultAsText function.
Example Databases
- CURL/CURL Low Level Sockets
- CURL/CURL with certificates included with FileMaker
- CURL/Email/IMAP Email List
- CURL/FTP/CURL FTP Directory Listing
- CURL/WebServices/CURL Query external IP
- CURL/WebServices/Google Maps API/Google Maps API
- CURL/WebServices/Magento2 REST API
- CURL/WebServices/Sales Force Test
- CURL/WebServices/Swiss Post Addresscheck V4-02-00
- CURL/WebServices/Twilio API Send SMS Json
Blog Entries
- MBS FileMaker Plugin, version 12.3pr5
- Using Apple's Global Service Exchange web service in FileMaker
- Let CURL handle cookie list
- Use root certificates included with FileMaker
- Using Apple's Global Service Exchange web service in FileMaker
- Query geolocation in FileMaker via MBS Plugin and Google Maps API
- Using NetVerify web service with FileMaker
- Swiss Post Webservice to verify addresses
- Using CURL with Rosette web service
- Detect and remove Byte order mark
FileMaker Magazin
Created 18th August 2014, last changed 19th April 2020
CURL.GetResultAsPNG - CURL.GetResultLength
Feedback: Report problem or ask question.
