0

I'm courious if it's possible to fetch pure text from any html source code.

here is my simple code :

preg_match_all("/>(.*)</",$htmlFile,$matches,PREG_SET_ORDER);

foreach ($matches as $match)
{
        highlight_string($match[0]);
}
die();

obviosly the problem that not everything between >(.*)< is a pure text. so for example in that scenario:

<table style="width:100%"><tr><th>Firstname</th><th>Lastname</th><th>Age</th></tr><tr><td>Jill</td><td>Smith</td><td>50</td></tr><tr><td>Eve</td><td>Jackson</td><td>94</td></tr></table>

I'm expecting to get :

Firstname,Lastname,Age,Jill,Smith,50,Eve,Jackson,94

PUG
  • 331
  • 1
  • 4
  • 14

0 Answers0