You need to use fopen to read the feed and pass the content to DOMDocument directly, like this:
$opts = array (
'http' => array (
'method' => "GET",
'header' => "Authorization: Basic " . base64_encode ( "$username:$password" ) .
"\r\n"
)
);
$context = stream_context_create ( $opts );
//read the feed
$fp = fopen ( $feedurl, 'r', false, $context );
//here you got the content
$context = stream_get_contents ( $fp );
fclose ( $fp );
$doc = new DOMDocument ();
//load the content
$doc->loadXML ( $context );
Also, php curl is better than fopen, see this: How do I make a request using HTTP basic authentication with PHP curl?