Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php domdocument get elements one by one

$array = [];
$i = 1;
foreach($dom->getElementsByTagName('*') as $node)
{
  if( $node->tagName != "html" AND $node->tagName != "body" AND $node->tagName != "br" )
  {
    $array[$i]['type'] = $node->tagName;
    $array[$i]['text'] = trim($node->textContent);
    $i++;
  }
}
 
PREVIOUS NEXT
Tagged: #php #domdocument #elements
ADD COMMENT
Topic
Name
8+2 =