- file_get_contents: documentation ( source)
<?php
try {
// This doesn't exist
$contents = file_get_contents('http://mal.formed.url/no-file.txt');
}
catch (Exception $ex) {
// This prints, but only after an E_WARNING message
echo "exception! ". $ex->getMessage();
}