What is the way to get first three words of a span class using PHP Simple HTML DOM Parser.
Assuming source code of a fetched page is:
Some Text
<span class="sos">Good Better Best<i> Some text</i> here</span>Again some text here
Using php simple html dom parser we can get all content of a span class like this way:
$data = $html->find('span class="sos"');
so here, $data will declare full content of that span class.
What i wanna do is to get only the first three words of a span class in a new variable, so in this case it should be:
$new_data = 'Good Better Best';
How to do it?
PHP Simple HTML DOM Parser Manual
as you have commented @billyonecan post , sounds like your solution is:
change all variables according to your needs.