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

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -