I need a little help here please.What am trying to do is pull all the content in b nodes.
<P><B>Credit Weighting: </B>5<BR><BR>
<B>Teaching Period(s): </B>Teaching Periods 1 and 2.<BR><BR>
<B>No. of Students: </B>-.<BR><BR>
<B>Pre-requisite(s): </B>None<BR><BR>
<P><A HREF="#top" class="toppage">[Top of page]</A></P>
<P><B>Credit Weighting: </B>20<BR><BR>
<B>Teaching Period(s): </B>Teaching Periods 1 and 2.<BR><BR>
<B>No. of Students: </B>-.<BR><BR>
<B>Pre-requisite(s): </B>None<BR><BR>
<P><A HREF="#top" class="toppage">[Top of page]</A></P>
<P><B>Credit Weighting: </B>10<BR><BR>
<B>Teaching Period(s): </B>Teaching Periods 1 and 2.<BR><BR>
<B>No. of Students: </B>-.<BR><BR>
<B>Pre-requisite(s): </B>None<BR><BR>
<P><A HREF="#top" class="toppage">[Top of page]</A></P>
I was able to pull data from the first set.Below is my sample code that does this
// GETTING ALL THE B NODE STUFFS AND PRINTING IT'S CONTENTS
$result = array();
foreach($document->getElementsByTagName('b') as $node){
$result[preg_replace('/:\s+$/','',$node->textContent)] = trim($node->nextSibling->textContent);
}
var_dump($result);
echo '<br /><br />';
Now what am trying to do is loop through the three set of html code to get all the b nodes and get the contetnts.How could I go about this please ?
You mean like this?
This gets you: