php - Extract text from HTML with a particular title -
php - Extract text from HTML <p> with a particular title -
i have huge file lots of entries, have 1 thing in common, the first line. i want extract of text paragraph first line is:
type of document: contract notice
the html
code working on here:
<!-- other html --> <p> <b>type of document:</b> " contract notice" <br> <b>country</b> <br> ... rest of text ... </p> <!-- other html -->
i have set html
dom
this:
$dom = new domdocument; $dom->loadhtml($content);
i need homecoming of text in paragraph node first line 'type of document: contract notice' i sure there simple way of doing using dom
methods or xpath
, please advise!
speaking of xpath, seek next look selects<p>
elements:
<b>
kid element (first one) has value type of document:
whose next sibling text node (first one) contains text contract notice
class="lang-none prettyprint-override">//p[ b[1][.="type of document:"] /following-sibling::text()[1][contains(., "contract notice")] ]
php html dom html-parsing domdocument
Comments
Post a Comment