Справочники, инструменты, документация

PHP: Как избавиться от ошибки file_get_contents failed to open stream

У меня есть php-файл, который получает содержимое по URL-адресу и при отсутствии URL выдает сообщение об ошибке...
Warning: file_get_contents(http://domen.ru): failed to open stream: HTTP request failed! in xxxx.php on line xx

Решение, применить функцию эквивалентную file_get_contents, которая может обрабатывать большие объемы данных.

function file_get_contents_curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}