title: How to catch error when get_headers() tries to resolve unresolvable host?
body: <p>Consider the following:</p>
  
  <pre><code>$url = 'http://psyng.com/u/9716602b';
  $headers = get_headers($url, 1);
  print_r($headers);
  </code></pre>
  
  <p>Since the domain psyng.com is unresolvable, this code results in:</p>
  
  <pre><code>Warning: get_headers(): php_network_getaddresses: getaddrinfo failed: 
  No such host is known
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>$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...
  }
  </code></pre>