I'm working on a project which is simply scrapping the comments of youtube but the condition is not to use cURL. So i started using simple html dom.php. I almost fought with many problems and now that are fixed. But i have a query that how to set an error for file_get_html() method. For example: I'm allowing user to enter the url of a youtube video, i have almost done a lot of validating of youtube URL, but still if someone will enter a wrong URL then the script will report this error: *Warning: file_get_contents(http://www.youtube.com/watch?v=VR--anQO?????222cV--clS8): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\xampp\htdocs\utube\simple_html_dom.php on line 39*
and i can't set error reporting to false as it's not allowed. So can you please say me how to display this error: Invalid URL instead of the error shown above. And yes please don't say about the youtube API as it's not allowed :(