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


The user agent text string.

Component Version macOS Windows Linux Server iOS SDK
CURL 2.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "CURL.SetOptionUserAgent"; curl; Value { ; Encoding } )   More


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.
"UTF8" Optional


Returns "OK" on success.


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.

See also USERAGENT option in CURL manual.


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

Blog Entries

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

CURL.SetOptionUseSSL - CURL.SetOptionUserName