I am trying to get text from an html file using the simplehtmldom lib for PHP. I only want the text after the <br> tag (TextAfterBreak) but only know how to get the entire text between the <font></font> tags (TextInsideFontTextAfterBreak in this case).
I’ve tried find("/td/font/br") but it returns an empty string perhaps because there’s no closing </br> tag? Any help would be greatly appreciated!
Here’s the source html source file snippet:
<td>
<font size="-1" face="Verdana, Helvetica, Arial, sans-serif" color="#330000">
TextInsideFont
<br>
TextAfterBreak
</font>
</td>
Here’s my code snippet:
$element=$row->find("/td/font");
echo $element =$element[0]->plaintext;
And the output:
TextInsideFontTextAfterBreak
Note: Every table row in the html file is unique so any regex or string manipulators won’t work.
explode()it after new line, becauseplaintextstripshtmldata: