Hi
Do not know how others will solve this problem. But I have my own way, just check the following code and it will help you.
Code:
$html = '<div class="pd">
<div class="section">
<div class="section_title">Title text</div>
</div>
<div>
<div><small>Info.</small></div>
</div>
<div class="section">
<div><a href="#">link</a> grab content <small>12/2/2009</small></div>
<div><a href="#">link</a> grab content <small>12/2/2009</small></div>
<div><a href="#">link</a> grab content <small>12/2/2009</small></div>
<div><a href="#">link</a> grab content <small>12/2/2009</small></div>
<div><a href="#">link</a> grab content <small>12/2/2009</small></div>
</div>
</div>';
// Skip first <div class="section">
$div1 = stripos($html,"<div class=\"section\">");
$html = str_ireplace(" ","",substr($html, stripos($html,"<div class=\"section\">",($div1+11))));
$out = arr();
$intK = 0;
//Strip away <div class="section"> and explode string into arr 1 element / row
$prt = explode("\n",substr($html, stripos($html,">")+2));
foreach ($prt as $val) {
</div>
if(trim($val) != "</div>") {
$out[$intK++] = $val;
}
}
print_r($out);
Bookmarks