You are here: Grab img tag from Google Web album's RSS item description « All PHP « IT news, forums, messages
Grab img tag from Google Web album's RSS item description

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>&nbsp;&nbsp;|&nbsp;&nbsp;<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].">";
}

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация