file_get_contents
do not throw an exception in error, instead it returns false, so you can check if the returned value is false:
$json = file_get_contents("sidiowdiowjdiso", true);
if ($json === false) {
//There is an error opening the file
}
This way you still get the warning, if you want to remove it, you need to put an @
in front of file_get_contents
. (This is considered a bad practice)
$json = @file_get_contents("sidiowdiowjdiso", true);