I am using str_get_html($string);
The content I am getting is:
> <div class="detail_sec"> <div class="news_post">
> <h3>Some title</h3> <p><span class="date_news">2 Jan
> 2015</span></p> <p align="justify">Read More :: <a
> href="/news/2015/2-jan.pdf" target="_blank">PDF</a> | <a
> href="/news/2015/2-jan.jpg" target="_blank">JPG</a></p> </div>
> </div>
<div class="detail_sec">
<div class="news_post">
<h3>Another title</h3>
<p><span class="date_news">1 Jan 2015</span></p>
<p align="justify">Read More :: <a href="/news/2015/1-jan.pdf" target="_blank">PDF</a> | <a href="/news/2015/2-jan.jpg" target="_blank">JPG</a></p>
</div>
</div>
.
.
.
I want to loop through this content, and get arrays for h3, date_news class, and anchor tags.. I tried this, its working but only h3 (or any other at a time), I want all in single loop.
foreach ( $html->find("div[class=news_post] h3") as $h3) {
$heading = trim($h3)->plaintext;
$headingArr[]=$heading;
}
var_dump($headingArr);
Thanks for any help.