Consider the following:
$url = 'http://psyng.com/u/9716602b';
$headers = get_headers($url, 1);
print_r($headers);
Since the domain psyng.com is unresolvable, this code results in:
Warning: get_headers(): php_network_getaddresses: getaddrinfo failed:
No such host is known
And then the script stops running. Is there a way to keep the rest of the script running - in other words: to catch the error, and move forward with resolving the next URL? So something like:
$url = 'http://psyng.com/u/9716602b';
$headers = get_headers($url, 1);
if ($headers == 'No such host is known') {
// nevermind, just move on to the next URL in the list...
}
else {
// resolve header stuff...
}