1CURLOPT_PASSWORD(3) curl_easy_setopt options CURLOPT_PASSWORD(3)
2
3
4
6 CURLOPT_PASSWORD - password to use in authentication
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PASSWORD, char *pwd);
12
14 Pass a char * as parameter, which should be pointing to the zero termi‐
15 nated password to use for the transfer.
16
17 The CURLOPT_PASSWORD(3) option should be used in conjunction with the
18 CURLOPT_USERNAME(3) option.
19
20 The application does not have to keep the string around after setting
21 this option.
22
24 blank
25
27 Most
28
30 CURL *curl = curl_easy_init();
31 if(curl) {
32 curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
33
34 curl_easy_setopt(curl, CURLOPT_PASSWORD, "qwerty");
35
36 ret = curl_easy_perform(curl);
37
38 curl_easy_cleanup(curl);
39 }
40
42 Added in 7.19.1
43
45 Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if
46 not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space.
47
49 CURLOPT_USERPWD(3), CURLOPT_USERNAME(3), CURLOPT_HTTPAUTH(3), CUR‐
50 LOPT_PROXYAUTH(3)
51
52
53
54libcurl 7.69.1 September 23, 2018 CURLOPT_PASSWORD(3)