I have a source page with a table which consists of 15 rows with this content:
<tr class="hlRow" onclick="window.location=link11.href" onmouseover="rowOver(11)" onmouseout="rowOut(11,'#cad9ea')">
<td class="row3">Latest news</td>
<td class="row3" id="row_6_11"><a onclick="servOC(11,'/link-to-page.html','',ihTri11)"><img class="tog" id="ihTri11" src="up.png" title="Toggle" height="19" width="19" /></a>14.7w</td>
<td class="row3" id="name11"><a href="/link-to-page.html" style="float: right; color: green; font-weight: bold;" title="+2 rating, 2 comments">+2<img src="star.png" alt="rating" style="margin-left: 1px;" height="12" width="12" /> 2<img src="bubble.png" alt="comments" style="margin-left: 2px;" height="10" width="10" /></a><a id="link11" href="/link-to-page.html">Got to page</a></td>
<td class="row3" title="11 files">10 days</td>
<td class="row3">104</td>
<td class="row3">108</td>
</tr>
Basically I need to take those rows between <tr>
to </tr>
tags from source site and show them on mine.
I've tried using preg_match_all()
, but as my regex experience is very limited I just can't do it properly.
preg_match_all('<tr class="hlRow"(.*?)</td></tr>/i', $turinys, $linkai, PREG_SET_ORDER);
foreach ($linkai as $linkas) {$a1 = $linkas[1]; echo "<table><tr class=\"hlRow\"".$a1."\"></td></tr></table>";}
Even more awesome would be to get only contents from inside of <td>
tags and then foreach those on my page.