Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>this solution requires you to the simple_html_dom. you can get it <a href="http://simplehtmldom.sourceforge.net/" rel="nofollow">here</a></p> <pre><code>&lt;?php require_once 'simple_html_dom.php'; $html = ' &lt;table class="articles"&gt; &lt;tbody&gt; &lt;tr&gt;some text here maybe tags&lt;/tr&gt; &lt;tr&gt; &lt;td&gt; some text here maybe tags &lt;/td&gt; &lt;td&gt; some text here maybe tags &lt;/td&gt; &lt;td&gt; some text here maybe tags &lt;/td&gt; &lt;td&gt; some text here maybe tags &lt;/td&gt; &lt;td&gt;&lt;a href="link.html"&gt;WANT TO GET THIS TEXT&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;table class="articles"&gt; &lt;tbody&gt; &lt;tr&gt;some text here maybe tags&lt;/tr&gt; &lt;tr&gt; &lt;td&gt; some text here maybe tags &lt;/td&gt; &lt;td&gt; some text here maybe tags &lt;/td&gt; &lt;td&gt; some text here maybe tags &lt;/td&gt; &lt;td&gt; some text here maybe tags &lt;/td&gt; &lt;td&gt;&lt;a href="link.html"&gt;WANT TO GET THIS TEXT&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;table class="articles"&gt; &lt;tbody&gt; &lt;tr&gt;some text here maybe tags&lt;/tr&gt; &lt;tr&gt; &lt;td&gt; some text here maybe tags &lt;/td&gt; &lt;td&gt; some text here maybe tags &lt;/td&gt; &lt;td&gt; some text here maybe tags &lt;/td&gt; &lt;td&gt; some text here maybe tags &lt;/td&gt; &lt;td&gt;&lt;a href="link.html"&gt;WANT TO GET THIS TEXT&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; '; $html = str_get_html($html); foreach($html-&gt;find('table[class=articles]') as $element){ $result = $element-&gt;find('tr'); $result = $result[1]-&gt;find('td'); echo($result[4]); echo('&lt;br&gt;'); } ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload