I am trying to error handle the file_get_contents method so even if the user enters an incorrect website it will echo an error message rather then the unprofessional
Warning: file_get_contents(sidiowdiowjdiso): failed to open stream: No such file or directory in C:\xampp\htdocs\test.php on line 6
I thought if i make a try and catch it will be able to catch the error but that did not work.
try
{
$json = file_get_contents("sidiowdiowjdiso", true); //getting the file content
}
catch (Exception $e)
{
throw new Exception( 'Something really gone wrong', 0, $e);
}