Here's the function I use to recursively get all text within a node:
function GetNodeText($ndNode)
{
$sTagText = "";
if ($ndNode->nodeName == "#text")
{
$sTagText = $ndNode->nodeValue;
}
if ($ndNode->hasChildNodes())
{
$sTagText .= GetNodeText($ndNode->firstChild);
}
if ($ndNode->nextSibling)
{
$sTagText .= GetNodeText($ndNode->nextSibling);
}
return $sTagText;
}