Detta bör fungera
Kod:
<?php
$auth = sprintf('Authorization: Basic %s', base64_encode('username:password') );
$opts = array(
'http'=>array(
'method'=>'GET',
'header'=> $auth)
);
$context = stream_context_create($opts);
fopen('http://host/directory/file.ext','r', false, $context);
?>