loadHTML works just fine.
loadHTML("Hey there mrlanrat!");
echo $dom->saveHTML();
?>
which outputs Hey there mrlanrat! in red.
or
loadHTML(" " . $bodyHTML . " ");
// this would even work as well.
// $bodyHTML = "here is the body, a nice body I might add";
// $dom->loadHTML($bodyHTML);
echo $dom->saveHTML();
?>
Which outputs:
here is the body, a nice body I might add and inside of your HTML source code, its wrapped inside body
tags.