check below code
$url="https://something.com";//place host here
$username="";//username for authentication
$password="";//password for authentication
$conn= curl_init();
curl_setopt($conn, CURLOPT_RETURNTRANSFER, true);
curl_setopt($conn, CURLOPT_URL, $url);
curl_setopt($conn, CURLOPT_HTTPHEADER, array("METHOD : POST"));//put other header like content-type etc..
curl_setopt($conn, CURLOPT_POSTFIELDS, $data_string);//if post method
curl_setopt($conn, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($conn, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
curl_setopt($conn, CURLOPT_USERPWD, $username.":".$password);
curl_setopt($conn, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($conn);
curl_close ($conn);
i used here CURLAUTH_NTLM for HTTP AUTH . HTTP NTLM authentication. A proprietary protocol invented and used by Microsoft.
https://curl.haxx.se/libcurl/c/CURLOPT_HTTPAUTH.html
curl_setopt($conn, CURLOPT_USERPWD, $username.":".$password);
CURLOPT_USERPWD used to set username and password and format is "[username]:[password]" to use for the connection.