PHP Simple HTML DOM parser - print class name -


i have little problem parsing data 1 webpage. i'm trying class name of div.

example:

< div class="stars b3"></div> 

i want save in array b3. possible this?

thanks!

see this:

<?php // http://stackoverflow.com/questions/4835300/php-dom-to-get-tag-class-with-multiple-css-class-name  $html = <<< html <td class="pos" >     <a class="firstlink" href="search/?list=200003000112097&sr=1" >         firs link value     </a>      <br />      <a class="secondlink secondclass" href="/search/?keyopt=all" >         second link value     </a> </td html;  $dom = new domdocument(); @$dom->loadhtml($html); $dom->preservewhitespace = false; $xpath = new domxpath($dom); $hrefs = $xpath->evaluate(     "/html/body//a[@class='secondlink secondclass']" ); echo $hrefs->item(0)->getattribute('class'); 

ref. http://codepad.org/vzvuxgrt


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -