I have the the following HTML string.
<div id="mydiv">
<pre>
Some content several lines.
Field1: value 2
Field2: value 2
Field3: value 3
Some content. several lines.
</pre>
</div>
I’m trying to get the text within the <pre> tags and break it down to its fields, so I’m using DomDocument() loadHTML() DOMXPath and query('//pre') to get the text content of <pre>.
When I var_dump its nodeValue I get formatted text just as it if were displayed using <pre>. I’m not sure why that’s the case, but I’m wondering if this can somehow help me break up the text to fields/values.
If you just want to read it in then just do it like this.