PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
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.
<?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--;
}
?>
That worked great! I just can't get my read more link to work properly. On the rss feed page the link says "view album". If I could get that to work normally, that would be awesome. How do I call the link thats on the feed?