How can stream context be utilized in PHP to manipulate HTTP response headers when using functions like file_get_contents for URL handling?

When using functions like `file_get_contents` in PHP for URL handling, you can utilize stream context to manipulate HTTP response headers. This allows you to set custom headers, such as User-Agent or Authorization, when making HTTP requests. By creating a stream context with the desired headers and passing it as a parameter to `file_get_contents`, you can modify the HTTP request and handle the response accordingly.

$url = 'http://example.com/api';
$options = [
    'http' => [
        'header' => "User-Agent: MyCustomUserAgent\r\n" .
                    "Authorization: Bearer myAccessToken"
    ]
];

$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);

echo $response;