CURL.SetOptionUserAgent
-----------------------

The user agent text string.

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

MBS( "CURL.SetOptionUserAgent"; curl; Value { ; Encoding } ) 

**MBS**( **"CURL.SetOptionUserAgent";** /\* The user agent text string. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Value**; /\* The user agent string.e.g. "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" \*/   
**$Encoding**) /\* Optional; The text encoding for text parameter.   
Default is UTF-8.e.g. "UTF8" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| curl | The CURL session handle. | $curl |  |
| Value | The user agent string. | "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" |  |
| Encoding | The text encoding for text parameter.    Default is UTF-8.   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). | "UTF8" | Optional |

### Result

Returns "OK" on success.

### Description

The user agent text string.  
It will be used for the user agent Header in the http request sent to the remote server. This can be used to fool servers or scripts. You can also set any custom header with [CURL.SetOptionHTTPHeader](CURLSetOptionHTTPHeader.md).  
See also [USERAGENT](https://curl.haxx.se/libcurl/c/CURLOPT_USERAGENT.html) option in CURL manual.

### Examples

Set IE 6 user agent:

 MBS ( "CURL.SetOptionUserAgent"; $curl ; "Mozilla/4.0 (compatible; MSIE 6.0 ; Windows NT 5.0 )" )  
Set Safari as user agent:

 MBS ( "CURL.SetOptionUserAgent"; $curl ; "Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_14\_6) AppleWebKit/605.1 .15 (KHTML, like Gecko) Version/13.0 .4 Safari/605.1 .15" )  
### See also

- [CURL.GetOptionUserName](CURLGetOptionUserName.md)
- [CURL.SetOptionHTTPHeader](CURLSetOptionHTTPHeader.md)
- [CURL.SetOptionIssuerCert](CURLSetOptionIssuerCert.md)
- [CURL.SetOptionUserName](CURLSetOptionUserName.md)

### Blog Entries

- [Translating Insert from URL options for CURL to MBS Plugin calls](https://www.mbsplugins.de/archive/2020-12-14/Translating_Insert_from_URL_op/monkeybreadsoftware_blog_filemaker)

Created 18th August 2014 , last changed 29th January 2020

  
[CURL.SetOptionUseSSL](CURLSetOptionUseSSL.md) - [CURL.SetOptionUserName](CURLSetOptionUserName.md)

[HTML Version](CURLSetOptionUserAgent.shtml)