php5 need something like innerHTML instead of nodeValue
I am using cURL and xpath to get data from an html page and everything is going well until I encounter a node like this:
Code:
<td id="foo">
The first bit of Data I want
<br>The second bit of Data I want
<br>The third bit of Data I want</td>
so I curl the page and setup my xpath like this:
Code:
$fooNode = $xpath->evaluate("/html/body//td[@id='foo'];
$fooString = $fooNode->item(0)->nodeValue;
$echo $fooString;
which gives me something like:
"The first bit of Data I wantThe second bit of Data I wantThe third bit of Data I want"
as a result with no way to separate the data (before you ask the data above is just an example, can't explode the string via "The")
What I would like instead is some way to return the node with markup intact sorta like innerHTML in js, so I can explode it to an array via the "<br>" tag. like:
"The first bit of Data I want<br>The second bit of Data I want<br>The third bit of Data I want"
Is there anyway to save a node as a string with <br> tags intact?
Forgive me if this has been answered before, I did look around the site and Googled all last night to no avail.