CURL.GetResultAsText
--------------------

Returns the result of the transaction as text.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [2.5](newinversion25.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.GetResultAsText"; curl { ; Encoding; preserveLineEndings } ) 

**MBS**( **"CURL.GetResultAsText";** /\* Returns the result of the transaction as text. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Encoding**; /\* Optional; 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.e.g. "UTF-8" \*/   
**$preserveLineEndings**) /\* Optional; 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.e.g. 0 \*/ 

### 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](https://www.monkeybreadsoftware.com/filemaker/faq.shtml). | "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](CURLGetResultAsContainer.md).  
  
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](TextReplaceNewLine.md)"; MBS ("CURL.GetResultAsText"; $curl );1)  
Download some text:

 Set Variable \[$curl ; Value:MBS ("[CURL.New](CURLNew.md)")\]  
Set Variable \[$result ; Value:MBS ("[CURL.SetOptionURL](CURLSetOptionURL.md)"; $curl ; CURL Test::URL )\]  
Set Field \[CURL Test::Result ; MBS ("[CURL.Perform](CURLPerform.md)"; $curl )\]  
Set Field \[CURL Test::Text ; MBS ("CURL.GetResultAsText"; $curl ; "UTF8")\]  
Set Variable \[$result ; Value:MBS ("[CURL.Release](CURLRelease.md)"; $curl )\]  
Download a text from URL:

 # start new transfer   
Set Variable \[$curl ; Value:MBS ("[CURL.New](CURLNew.md)")\]  
\# set URL   
Set Variable \[$r ; Value:MBS ("[CURL.SetOptionURL](CURLSetOptionURL.md)"; $curl ; "https://www.mbsplugins.eu/")\]  
\# run transfer   
Set Variable \[$ErrorCode ; Value:MBS ("[CURL.Perform](CURLPerform.md)"; $curl )\]  
\# get result as text and debug messages:   
Set Variable \[$TextResult ; Value:MBS ( "CURL.GetResultAsText"; $curl )\]  
Set Variable \[$DebugMessages ; Value:MBS ( "[CURL.GetDebugMessages](CURLGetDebugMessages.md)"; $curl )\]  
\# cleanup   
Set Variable \[$r ; Value:MBS ("[CURL.Release](CURLRelease.md)"; $curl )\]  
Query webservice with JSON request:

 Set Variable \[$curl ; Value:MBS ("[CURL.New](CURLNew.md)")\]  
Set Variable \[$result ; Value:MBS ("[CURL.SetOptionURL](CURLSetOptionURL.md)"; $curl ; "http://test.test/ws/v1/catalogo/getmodelos")\]  
\#pass JSON for query   
Set Variable \[$result ; Value:MBS ("[CURL.SetOptionPostFields](CURLSetOptionPostFields.md)"; $curl ; "{\\"brandId\\" : \\"1\\", \\"device\\" : \\"70\\"}"; "UTF-8")\]  
Set Field \[models::result ; MBS ("[CURL.Perform](CURLPerform.md)"; $curl )\]  
Set Field \[models::text ; MBS ("CURL.GetResultAsText"; $curl ;"UTF8")\]  
Set Field \[models::header ; MBS ("[CURL.GetDebugMessages](CURLGetDebugMessages.md)"; $curl )\]  
Set Variable \[$result ; Value:MBS ("[CURL.Release](CURLRelease.md)"; $curl )\]  
Query list of emails via POP3:

 # query list of emails   
Set Variable \[ $curl ; Value: MBS ("[CURL.New](CURLNew.md)") \]   
\#   
\# setup pop3 server   
Set Variable \[ $r ; Value: MBS ("[CURL.SetOptionURL](CURLSetOptionURL.md)"; $curl ; "pop3://sslin.df.eu/") \]   
Set Variable \[ $result ; Value: MBS ("[CURL.SetOptionUseSSL](CURLSetOptionUseSSL.md)"; $curl ; 3) // required \]   
Set Variable \[ $result ; Value: MBS ("[CURL.SetOptionSSLVersion](CURLSetOptionSSLVersion.md)"; $curl ; 6) // TLS v1.2 \]   
\#   
\# login   
Set Variable \[ $r ; Value: MBS ("[CURL.SetOptionUserName](CURLSetOptionUserName.md)"; $curl ; Postbox::Username ) \]   
Set Variable \[ $r ; Value: MBS ("[CURL.SetOptionPassword](CURLSetOptionPassword.md)"; $curl ; Postbox::Password ) \]   
\#   
\# list emails   
Set Variable \[ $result ; Value: MBS ("[CURL.Perform](CURLPerform.md)"; $curl ) \]   
\# We show results for debugging   
Set Variable \[ $output ; Value: MBS ("CURL.GetResultAsText"; $curl ) \]   
Set Variable \[ $debug ; Value: MBS ("[CURL.GetDebugAsText](CURLGetDebugAsText.md)"; $curl ) \]   
Set Variable \[ $r ; Value: MBS ("[CURL.Release](CURLRelease.md)"; $curl ) \]   
\#   
Set Field \[ Postbox::Log ; $debug \]   
Set Field \[ Postbox::Output ; $output \]  
Get multiple emails via POP3 over the same connection by reusing it:

 # query list of emails   
Set Variable \[ $curl ; Value: MBS ("[CURL.New](CURLNew.md)") \]   
\#   
\# setup pop3 server   
Set Variable \[ $result ; Value: MBS ("[CURL.SetOptionUseSSL](CURLSetOptionUseSSL.md)"; $curl ; 3) // required \]   
Set Variable \[ $result ; Value: MBS ("[CURL.SetOptionSSLVersion](CURLSetOptionSSLVersion.md)"; $curl ; 6) // TLS v1.2 \]   
\#   
\# login   
Set Variable \[ $r ; Value: MBS ("[CURL.SetOptionUserName](CURLSetOptionUserName.md)"; $curl ; IMAP Postbox::Username ) \]   
Set Variable \[ $r ; Value: MBS ("[CURL.SetOptionPassword](CURLSetOptionPassword.md)"; $curl ; IMAP Postbox::Password ) \]   
\#   
\# get first email   
Set Variable \[ $r ; Value: MBS ("[CURL.SetOptionURL](CURLSetOptionURL.md)"; $curl ; "pop3://sslin.df.eu/1") \]   
Set Variable \[ $result ; Value: MBS ("[CURL.Perform](CURLPerform.md)"; $curl ) \]   
\#   
\# We show results for debugging   
Set Variable \[ $output ; Value: MBS ("CURL.GetResultAsText"; $curl ) \]   
Set Variable \[ $debug ; Value: MBS ("[CURL.GetDebugAsText](CURLGetDebugAsText.md)"; $curl ) \]   
Set Field \[ IMAP Postbox::Log ; $debug \]   
Set Field \[ IMAP Postbox::Output ; $output \]   
\#   
\# give you time to see it   
Pause/Resume Script \[ Indefinitely \]   
\# get second email, reuse same curl connection   
Set Variable \[ $r ; Value: MBS ("[CURL.SetOptionURL](CURLSetOptionURL.md)"; $curl ; "pop3://sslin.df.eu/2") \]   
Set Variable \[ $result ; Value: MBS ("[CURL.Perform](CURLPerform.md)"; $curl ) \]   
\#   
\# We show results for debugging   
Set Variable \[ $output ; Value: MBS ("CURL.GetResultAsText"; $curl ) \]   
Set Variable \[ $debug ; Value: MBS ("[CURL.GetDebugAsText](CURLGetDebugAsText.md)"; $curl ) \]   
Set Field \[ IMAP Postbox::Log ; $debug \]   
Set Field \[ IMAP Postbox::Output ; $output \]   
\#   
\# give you time to see it   
Pause/Resume Script \[ Indefinitely \]   
\# get third email, reuse same curl connection   
Set Variable \[ $r ; Value: MBS ("[CURL.SetOptionURL](CURLSetOptionURL.md)"; $curl ; "pop3://sslin.df.eu/3") \]   
Set Variable \[ $result ; Value: MBS ("[CURL.Perform](CURLPerform.md)"; $curl ) \]   
\#   
\# We show results for debugging   
Set Variable \[ $output ; Value: MBS ("CURL.GetResultAsText"; $curl ) \]   
Set Variable \[ $debug ; Value: MBS ("[CURL.GetDebugAsText](CURLGetDebugAsText.md)"; $curl ) \]   
Set Field \[ IMAP Postbox::Log ; $debug \]   
Set Field \[ IMAP Postbox::Output ; $output \]   
\#   
Set Variable \[ $r ; Value: MBS ("[CURL.Release](CURLRelease.md)"; $curl ) \]  
### See also

- [CURL.GetDebugAsText](CURLGetDebugAsText.md)
- [CURL.GetHeaderAsText](CURLGetHeaderAsText.md)
- [CURL.GetResultAsData](CURLGetResultAsData.md)
- [CURL.GetResultAsJPEG](CURLGetResultAsJPEG.md)
- [CURL.GetResultAsPDF](CURLGetResultAsPDF.md)
- [CURL.GetResultAsPNG](CURLGetResultAsPNG.md)
- [CURL.SetupOAuth](CURLSetupOAuth.md)
- [CURL.UseSystemCertificates](CURLUseSystemCertificates.md)
- [JSON.GetPathItem](JSONGetPathItem.md)
- [Text.ReplaceNewLine](TextReplaceNewLine.md)

### Release notes

- **Version 12.3**
    - Fixed a possible race condition for [CURL.GetResultAsText](https://www.mbsplugins.eu/CURLGetResultAsText.shtml) and similar.
- **Version 9.3**
    - Added preserveLineEndings parameter for [CURL.GetDebugAsText](http://www.mbsplugins.eu/CURLGetDebugAsText.shtml), [CURL.GetHeaderAsText](http://www.mbsplugins.eu/CURLGetHeaderAsText.shtml), [CURL.GetInputAsText](http://www.mbsplugins.eu/CURLGetInputAsText.shtml) and [CURL.GetResultAsText](http://www.mbsplugins.eu/CURLGetResultAsText.shtml) function.

### Example Databases

- [CURL/Amazon S3/Amazon S3 Upload File](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Amazon%20S3/Amazon%20S3%20Upload%20File.shtml#3ScriptAnchor_)
- [CURL/Amazon S3/Containers in S3](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Amazon%20S3/Containers%20in%20S3.shtml#2ScriptAnchor_)
- [CURL/CURL Check FileMaker Server](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/CURL%20Check%20FileMaker%20Server.shtml#1ScriptAnchor_)
- [CURL/CURL Download Text](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/CURL%20Download%20Text.shtml#1ScriptAnchor_)
- [CURL/Email/List IMAP folders](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/List%20IMAP%20folders.shtml#1ScriptAnchor_)
- [CURL/Email/Office 365 oAuth SMTP](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/Office%20365%20oAuth%20SMTP.shtml#3ScriptAnchor_)
- [CURL/WebServices/CURL FMS Admin API v18](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/CURL%20FMS%20Admin%20API%20v18.shtml#1ScriptAnchor_)
- [CURL/WebServices/Google Maps API/Google Maps API](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/Google%20Maps%20API/Google%20Maps%20API.shtml#1ScriptAnchor_)
- [CURL/WebServices/Swiss Post Addresscheck](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/Swiss%20Post%20Addresscheck.shtml#1ScriptAnchor_)
- [CURL/WebServices/Twitter oAuth](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/Twitter%20oAuth.shtml#1ScriptAnchor_)

### Blog Entries

- [Using Gmail with oAuth2 for SMTP with MBS Plugin](https://www.mbsplugins.de/archive/2025-05-08/Using_Gmail_with_oAuth2_for_SM/monkeybreadsoftware_blog_filemaker)
- [Send SMS with Amazon web service](https://www.mbsplugins.de/archive/2025-01-20/Send_SMS_with_Amazon_web_servi/monkeybreadsoftware_blog_filemaker)
- [Using ChatGPT in FileMaker](https://www.mbsplugins.de/archive/2024-10-16/Using_ChatGPT_in_FileMaker/monkeybreadsoftware_blog_filemaker)
- [Adding ChatGPT to the ScriptWorkspace context menu](https://www.mbsplugins.de/archive/2024-09-18/Adding_ChatGPT_to_the_ScriptWo/monkeybreadsoftware_blog_filemaker)
- [MQTT in FileMaker](https://www.mbsplugins.de/archive/2024-06-25/MQTT_in_FileMaker/monkeybreadsoftware_blog_filemaker)
- [Parallel network transfers with MBS Plugin](https://www.mbsplugins.de/archive/2023-12-18/Parallel_network_transfers_wit/monkeybreadsoftware_blog_filemaker)
- [How long do you wait for Insert From URL to finish?](https://www.mbsplugins.de/archive/2023-10-10/How_long_do_you_wait_for_Inser/monkeybreadsoftware_blog_filemaker)
- [SFTP Upload with temporary file](https://www.mbsplugins.de/archive/2023-03-06/SFTP_Upload_with_temporary_fil/monkeybreadsoftware_blog_filemaker)
- [CURL Custom Function](https://www.mbsplugins.de/archive/2022-12-12/CURL_Custom_Function/monkeybreadsoftware_blog_filemaker)
- [Trigger Scripts via WebHook](https://www.mbsplugins.de/archive/2022-12-08/Trigger_Scripts_via_WebHook/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 2/2025, Seite 24](https://filemaker-magazin.de/neuigkeit/4286-Appetithappen-FMM_202502)
- [Ausgabe 2/2025, Seite 22](https://filemaker-magazin.de/neuigkeit/4286-Appetithappen-FMM_202502)
- [Ausgabe 2/2024, Seite 18](https://filemaker-magazin.de/neuigkeit/4257-Appetithappen-FMM_202402)
- [Ausgabe 6/2021, Seite 23](https://filemaker-magazin.de/neuigkeit/4165-Appetithappen-FMM_202106)
- [Ausgabe 4/2016, Seite 18 bis 20](https://filemaker-magazin.de/neuigkeit/3876-Appetithappen-FMM_201604)

This function checks for a license.

Created 18th August 2014 , last changed 16th February 2023

  
[CURL.GetResultAsPNG](CURLGetResultAsPNG.md) - [CURL.GetResultLength](CURLGetResultLength.md)

[HTML Version](CURLGetResultAsText.shtml)