Posted by Chris Matchett on 01/16/07 16:39
How can I remove everything but the img tag, and it's attributes, from
the html generated by Google Web Album's RSS item description shown
below?
I have the code I am using at present below but I was hoping for a more
reliable alternative.
Cheers,
Chris
// HTML generated by Google
<table>
<tr><td>
<div style="text-align:center;height:194px;">
<a href="http://www.test.com/">
<img style="margin-top:15px;border:1px solid #5C7FB9"
src="http://www.test.com" alt="City001.JPG" border="0"/>
</a>
</div>
</td>
<td valign="top"><p><font color="#333333"></font></p>
<p><font color="#333333"><b>City001.JPG</b></font></p>
<font color="#6B6B6B">Date: </font><font color="#333333">16-Jan-2007
02:38</font>
<br/><font color="#6B6B6B">Number of Comments on Photo: </font>
<font color="#333333">0</font><br/>
<p><a href="http://www.test.com">
<font color="#112ABB"><b>View
Photo</b></font></a> | <a
href="http://www.test.com"><font color="#112ABB"><b>View
Feed</b></font></a></p></div></td></tr></table>
// Code I am using at present
foreach ($rss->items as $item) {
$strip_img = strip_tags($item['description'], '<img>');
$explode_string = explode(">", $strip_img);
$img[] .= $explode_string[0].">";
}
[Back to original message]
|