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:

whose <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

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -