1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_PASSWORD 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_HTTPAUTH (3) 9 - CURLOPT_PROXYAUTH (3) 10 - CURLOPT_USERNAME (3) 11 - CURLOPT_USERPWD (3) 12--- 13 14# NAME 15 16CURLOPT_PASSWORD - password to use in authentication 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PASSWORD, char *pwd); 24~~~ 25 26# DESCRIPTION 27 28Pass a char pointer as parameter, which should be pointing to the 29null-terminated password to use for the transfer. 30 31The CURLOPT_PASSWORD(3) option should be used in conjunction with the 32CURLOPT_USERNAME(3) option. 33 34The application does not have to keep the string around after setting this 35option. 36 37# DEFAULT 38 39blank 40 41# PROTOCOLS 42 43Most 44 45# EXAMPLE 46 47~~~c 48int main(void) 49{ 50 CURL *curl = curl_easy_init(); 51 if(curl) { 52 CURLcode res; 53 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin"); 54 55 curl_easy_setopt(curl, CURLOPT_PASSWORD, "qwerty"); 56 57 res = curl_easy_perform(curl); 58 59 curl_easy_cleanup(curl); 60 } 61} 62~~~ 63 64# AVAILABILITY 65 66Added in 7.19.1 67 68# RETURN VALUE 69 70Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or 71CURLE_OUT_OF_MEMORY if there was insufficient heap space. 72