I'm using the simplehtmldom parser to parse URL contents.
It contains the following line of code:
$contents = file_get_contents($url, $use_include_path, $context, $offset);
file_get_contents
returns a warning when the URL does not exist. How can I handle all possible errors for such case, i.e. 404 and all other possible errors.
Warning: file_get_contents(http://www.something-not-valid-bla-bla-1234.com/): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in simple_html_dom.php on line 76