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

CURL.SetOptionPassword

Sets the password for this transfer.

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

Parameters

Parameter Description Example Flags
curl The CURL session handle. $curl
Value The password text. "test123"
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

Result

Returns "OK" on success.

Description

Sets the password for this transfer.
The CURL.SetOptionPassword option should be used in conjunction with the CURL.SetOptionUserName option.

For SFTP you may need to set CURL.SetOptionSSHAuthTypes with types 10 to use password.

See also PASSWORD option in CURL manual.

Examples

Set login credentials:

Set Variable [ $result ; Wert: MBS("CURL.SetOptionUserName"; $curl; Logins::Username) ]
Set Variable [ $result ; Wert: MBS("CURL.SetOptionPassword"; $curl; Logins::Password) ]

Use netverify.com to check a driver license:

#Setup transfer
Set Variable [$r; Value:MBS("Trace")]
Set Variable [$curl; Value:MBS("CURL.New")]
Set Variable [$result; Value:MBS("CURL.SetOptionURL"; $curl; "https://netverify.com/api/netverify/v2/fastfill")]
Set Variable [$result; Value:MBS("CURL.SetOptionVerbose"; $curl; 1)]
Set Variable [$result; Value:MBS("CURL.SetOptionUserName"; $curl; "25D63FB16966473DA2416454FD468BBD")]
Set Variable [$result; Value:MBS("CURL.SetOptionPassword"; $curl; "4356789038498914948018924658901622")]
Set Variable [$result; Value:MBS("CURL.SetOptionVerbose"; $curl; 1)]
Set Variable [$result; Value:MBS("CURL.SetOptionHTTPHeader"; $curl; "Accept: application/json"; "Expect:")]
Set Variable [$metadata; Value:"{\"type\": \"DRIVING_LICENSE\",\"country\": \"USA\"}"]
Set Variable [$r; Value:MBS("CURL.FormAddKeyValue";$curl; "metadata"; $metadata)]
Set Variable [$r; Value:MBS("CURL.FormAddKeyContainerContentType";$curl; "backsideImage"; "test.jpg"; Donor Docs::DocPDF; "image/jpeg")]
Set Variable [$r; Value:MBS("CURL.FormFinish";$curl)]
#Run transfer
Set Field [Donor Docs::ResultCodePost; MBS("CURL.Perform"; $curl)]
#Check result
Set Field [Donor Docs::DebugTextPost; MBS("CURL.GetDebugMessages"; $curl) ]
Set Variable [$result; Value: MBS("CURL.GetResultAsText"; $curl)]
Set Field [Donor Docs::ResultTextPost; $result]
Set Variable [$r; Value:MBS("CURL.Release";$curl)]

Download file via SFTP to file on disk:

Set Variable [$curl; Value:MBS("CURL.New") ]
# set download URL, e.g. sftp://monkeybreadsoftware.net/test.jpg
Set Variable [$result; Value:MBS("CURL.SetOptionURL"; $curl; SFTP Download::URL )]
# build file path on disk and open output file
Set Variable [$name; Value:GetValue(SFTP Download::FileName; 1)]
Set Variable [$path; Value:MBS( "Path.AddPathComponent"; SFTP Download::FolderPath; $name )]
Set Variable [$r; Value:MBS("CURL.CreateOutputFile"; $curl; $path)]
# login only via password
Set Variable [$result; Value:MBS( "CURL.SetOptionSSHAuthTypes"; $curl; 2+8 )]
# set credentials
Set Variable [$result; Value:MBS("CURL.SetOptionUserName"; $curl; SFTP Download::UserName )]
Set Variable [$result; Value:MBS("CURL.SetOptionPassword"; $curl; SFTP Download::Password )]
# run transfer
Set Field [SFTP Download::ErrorCode; MBS("CURL.Perform"; $curl)]
# check debug log for errors
Set Field [SFTP Download::Debug; MBS("CURL.GetDebugMessages"; $curl)]
# free CURL session
Set Variable [$result; Value:MBS("CURL.Release"; $curl)]

Enable password and disable key file authorization for SSH:

MBS( "CURL.SetOptionSSHAuthTypes"; $curl; 2+8 )

See also

Release notes

Example Databases

Blog Entries

Created 18th August 2014, last changed 11st September 2023


CURL.SetOptionNoProxy - CURL.SetOptionPathAsIs