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