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');
Comments
Post a Comment