Good Evening,
I've been tasked with launching a URI like file:// however if it doesn't exist or fails to run then the page needs to display a message. I have done a fair amount of research and can't find anything about how to do this. Does anyone know how to catch errors from the header function?
I have tried doing:
try {
header("Location: URLPATH");
} catch(Exception $e) {
somecode
}
this doesn't doing anything.
I have also tried:
header("Location: URLPATH");
if (!headers_sent()) {
echo('Error');
}
this will only work if the header isn't sent, say if I mistype or something like that.
I have also attempted to do the same in javascript however this also doesn't work.
I'm stuck, help please?
Thank you kindly.