How can I make sure my sending username and password combination is correct without grabbing the whole html page in php cURL?
You have 2 options.
1)use CURLOPT_USERPWD except of CURLOPT_POSTFIELDS
2)send is as properly formatted Content-Type (as target requires) for example send json
$params = [ "username" => $username, "passwd" => $passwd,];
$json = json_encode($params);
curl_setopt($ch,CURLOPT_POSTFIELDS, $json);