Results 1 to 9 of 9
Apr 16, 2009, 13:29 #1
- Join Date
- Aug 2003
- 0 Post(s)
- 0 Thread(s)
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:
<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>
$fooNode = $xpath->evaluate("/html/body//td[@id='foo']; $fooString = $fooNode->item(0)->nodeValue; $echo $fooString;
"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.