title: Failsafe for PHP Simple HTML DOM Parser
body: <p>Using PHP Simple HTML DOM Parser (<a href="http://simplehtmldom.sourceforge.net" rel="nofollow">http://simplehtmldom.sourceforge.net</a>), I recently had a situation where the external webpage I routinely fetch was not responding (their servers were down). Because of this the my own website would not load (instead it showed errors after a lengthy wait period).</p>
  
  <p>What would be the best way to add a failsafe to this parser upon an unsucessful fetch attempt?</p>
  
  <p>I have tried to use the following below without success.</p>
  
  <pre><code>include('./inc/simple_html_dom.php');  
  
  $html = file_get_html('http://client0.example.com/dcnum.php?count=1');
  $str = $html-&gt;find('body',0);
  $num = $str-&gt;innertext;
  
  if(!$html)
  {
   error('No response.')
  }
  
  $html-&gt;clear(); 
  unset($html);
  </code></pre>
  
  <p>EDIT: I haven't had time to try this yet, but perhaps I could place my 'if' statement directly after the first line (before the $html->find('body',0) part).</p>