You will need to add a stream context to get the extra data in your request. Try something like the following untested code. It’s based on one of the examples on the PHP documentation for file_get_contents()
:
$auth = base64_encode("username:password");
$context = stream_context_create([
"http" => [
"header" => "Authorization: Basic $auth"
]
]);
$homepage = file_get_contents("http://example.com/file", false, $context );