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

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -