- var_dump: documentation ( source)
- libxml_get_errors: documentation ( source)
- print_r: documentation ( source)
- libxml_use_internal_errors: documentation ( source)
<?php
$html = '<html><body>
<a href="a.html">some a</a>
<a href="b.html">some b</a>
</body></html>';
libxml_use_internal_errors(true); // ignore malformed HTML
$xml = new DOMDocument();
$xml->loadHTML($html);
foreach($xml->getElementsByTagName('a') as $link) {
var_dump($link->nodeValue);
$link->nodeValue = 'abc';
}
print_r(libxml_get_errors());
print_r($html);