php - return multiple nodes with xpath -
how return more 1 node on page? here code using, returns 1st node found.
$dom = new domdocument; $dom->loadhtmlfile($url); $xpath = new domxpath($dom); $users= $xpath->query('//b[@class="xc_user"]'); echo $users->item(0)->nodevalue;
$users
domnodelist, can iterate over:
foreach($users $node) { echo $node->nodevalue; }
Comments
Post a Comment