CURLOPT_USERPWD - set user + password to work with
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USERPWD, char *userpwd);
Pass a char * as parameter, pointing to a zero terminated login details string for the connection. The format of which is: [user name]:[password].
When using NTLM, you can set the domain by prepending it to the user name and separating the domain and name with a forward (/) or backward slash (\). Like this: "domain/user:password" or "domain\user:password". Some HTTP servers (on Windows) support this style even for Basic authentication.
When using HTTP and CURLOPT_FOLLOWLOCATION, libcurl might perform several requests to possibly different hosts. libcurl will only send this user and password information to hosts using the initial host name (unless CURLOPT_UNRESTRICTED_AUTH is set), so if libcurl follows locations to other hosts it will not send the user and password to those. This is enforced to prevent accidental information leakage.
Use CURLOPT_HTTPAUTH to specify the authentication method for HTTP based connections or CURLOPT_LOGIN_OPTIONS to control IMAP, POP3 and SMTP options.
The user and password strings are not URL decoded, so there's no way to send in a user name containing a colon using this option. Use CURLOPT_USERNAME for that, or include it in the URL.
Returns CURLE_OK on success or CURLE_OUT_OF_MEMORY if there was insufficient heap space.
CURLOPT_USERNAME CURLOPT_PASSWORD
This HTML page was made with roffit.