Php curl carries out digest authentication

digest authentication is required when calling api. The code and error message are as follows:
$curl=curl_init ();
curl_setopt ($curl,CURLOPT_URL,$url);
curl_setopt ($curl,CURLOPT_HTTPAUTH,CURLAUTH_DIGEST);
curl_setopt ($curl,CURLOPT_USERPWD,$username. ":". $password);
$data=curl_exec ($curl);
echo $data;

)

HTTP Status 401-Response realm name {0} does not match system realm name of {1}

do you still need to set up realm? How should it be set up?

Jul.23,2021

CURLOPT_USERNAME

write separately.

Menu