I am using SimpleHTMLDOM Parser to browse a website and I would like to know if there is a way to handle errors. For example, if the link is broken, there is no point in advancing through the code and looking for a document.
Thank.
<?php $html = file_get_html('http://www.google.com/'); foreach($html->find('a') as $element) { if(empty($element->href)) { continue; //will skip <a> without href } echo $element->href . "<br>\n"; } ?>
cycle and continue?