07-07-2008, 01:32 PM
|
#2 (permalink)
|
|
The Addict
Join Date: Nov 2007
Location: the Netherlands
Posts: 281
Thanks: 2
|
With Noia from #talkPHP:
PHP Code:
<?php
//only use when needed!
//ini_set("user_agent","Internet Explorer");
//Edit here for your rss link
$location = "http://youtube.com/rss/global/top_rated.rss";
$contents = file_get_contents($location);
$xml = new SimpleXMLElement($contents);
$deslimit = 100;
print "<ol>";
// Loop results
foreach($xml->channel->item as $item) {
print "<li>";
print "<a href='".$item->link."' title='".$item->title."'>";
print $item->title;
print "</a>";
// Edit description to length
if(strlen($item->description) > $deslimit) {
$item->description = trim(substr($item->description), 0, $deslimit) . '...';
}
print "<p>".$item->description."</p>";
print "</li>";
}
print "</ol>";
Not tested, but should work :)
__________________
Nunchaku! Who doesn't like martial arts? =)
|
|
|