- libxml_use_internal_errors: documentation ( source)
<?php
$html = '
<html>
<head>
<title>DOMDocument test-case</title>
</head>
<body>
<div class="dummy-container">
<h1 _ngcontent-c0="" class="br-hdng"><span _ngcontent-c0="" class="pr dib">hair fall shamboo<!----></span></h1>
</div>
</body>';
$dom = new DOMDocument;
$oldSetting = libxml_use_internal_errors(true);
$dom->loadHTML( $html );
libxml_use_internal_errors($oldSetting);
$xpath = new DOMXPath( $dom );
$title = $xpath->query( '//h1[@class="br-hdng"]/span' )->item( 0 )->nodeValue;
echo $title;