Skip to content

Instantly share code, notes, and snippets.

Created July 24, 2010 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/488815 to your computer and use it in GitHub Desktop.
Save anonymous/488815 to your computer and use it in GitHub Desktop.
require_once('simple_html_dom.php');
$example = <<<XML
<div class="local-tabs">
<div class="local-tab active">Set1 <span class="searchresults_tab_number">(3869)</span></div>
<div class="local-tab"><a href="#">Set2 <span class="searchresults_tab_number">(1)</span></a></div>
<div class="local-tab"><a href="#">Set3 <span class="searchresults_tab_number">(3870)</span></a></div>
</div>
XML;
$html = new simple_html_dom();
$html->load($example);
foreach($html->find('span[class=searchresults_tab_number]') as $element) {
echo $element->innertext . '<br />';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment