From the documentation (section: How to access HTML element attributes? / Tips):
$e->outertext = $e->outertext . '<div>foo<div>';
What you can use as follows:
$e = $html->find('head')->innertext;
$e = $e.'<link href="style.css" rel="stylesheet" type="text/css" />';
I have not tried, but maybe (depending on the class) you may need to make the first line in 2.
$f = $html->find('head');
$e = $f->innertext;
But you get it, right ?;)
source
share