Hi,
I am looking to take the latest news from various sites.
However, it runs slow (sometimes upto 30 secs).
Here's my code:
<?php
// rss page for Testing -
//$feed_url = "http://news.sky.com/sky-news/rss/home/rss.xml";
//$feed_url = "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml";
$feed_url = "http://rss.cnn.com/rss/edition_business.rss";
$xml = simplexml_load_file($feed_url);
// How many items to display
$count = 12;
// How many characters from each item
// 0 (zero) will show them all.
$char = 0;
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"
<h2><a href='{$item->guid}' target='_blank'>{$item->title}</a></h2>
<p>$newstring</p>
<br />
";
}
$count--;
}
?>
Any way I could speed it up?
Thanks