<?php
$str = <<<EOF
<listing name="name goes there" phone="321321" phone="any phone" attr1="value 1" attr2="value 2">Text description</listing>
<anytag name="another name" phone="any phone" attr1="value 1" attr2="value 2">any can be written&nbsp; where &copy;MyRight</anytag>
<anytag name="another name line 2" phone="65851566" attr1="value &euml;" attr2="value 2">any can be written&nbsp; where &reg;MyRight&euml;ous</anytag>
EOF;
$dom = new DOMDocument();
libxml_use_internal_errors(true);
$dom->loadHTML($str);

$nodeList = $dom->getElementsByTagName('anytag');
for($i=0; $i < $nodeList->length; $i++) {
    $node = $nodeList->item($i);
    if ($node->hasAttributes())
       echo $node->nodeName . " =>\n";
       foreach ($node->attributes as $attr) {
          $name = $attr->nodeName;
          $value = $attr->nodeValue;
          echo "Attribute '$name'='$value'\n";
       }
}
?>