Show an RSS feed on another page including photos
Posted: Thu May 19, 2011 10:02 am
If you goto http://www.actionfx.net/bfd/photos.php you will see that im trying to show an rss feed from http://picasaweb.google.com/data/feed/b ... ess=public
My code works well if its just text on the rss but it does not work on this particular rss. I want the photos to show up on my page also. Im hoping someone here can be so kind to help me out with this coding. Below is my code.
My code works well if its just text on the rss but it does not work on this particular rss. I want the photos to show up on my page also. Im hoping someone here can be so kind to help me out with this coding. Below is my code.
Code: Select all
<?php
$feed_url = "http://picasaweb.google.com/data/feed/base/user/114565750484201639035?alt=rss&kind=album&hl=en_US&access=public";
// INITIATE CURL.
$curl = curl_init();
// CURL SETTINGS.
curl_setopt($curl, CURLOPT_URL,"$feed_url");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
// GRAB THE XML FILE.
$xmlTwitter = curl_exec($curl);
curl_close($curl);
// SET UP XML OBJECT.
// Use either one of these, depending on revision of PHP.
// Comment-out the line you are not using.
//$xml = new SimpleXMLElement($xmlTwitter);
$xml = simplexml_load_string($xmlTwitter);
// How many items to display
$count = 10;
// How many characters from each item
// 0 (zero) will show them all.
$char = 100;
foreach ($xml->channel->item as $item) {
if($char == 0){
$newstring = $item->description;
}
else{
$newstring = substr($item->description, 0, $char);
}
if($count > 0){
//in case they have non-closed italics or bold, etc ...
echo"</i></b></u></a>\n";
echo"
<div style='font-family:verdana; font-size:.12;'>
<b>{$item->title}</b><br />
$newstring ... <span class='redlink' id='redlink' style='redlink'> <a href='{$item->guid}'>read more</a> </span>
<br /><br />
</div>
";
}
$count--;
}
?>