I am trying to pull data from a source, then parse the data for 3 different fields: "title", "link", "description" and then output the data. However, the loop appears to load the first 10 articles, but then turns into a never ending loop . How do I fix this?
<?php
#Load in File
$xmlUrl ="http://sports.yahoo.com/mlb/rss.xml";
$ConvertToXml = simplexml_load_file($xmlUrl);
# -> Setup XML
$newsStory = $ConvertToXml->channel->item;
# -----> Load News Stories
for($i = 0;i<10; $i++){
$title=$newsStory[$i]->title;
//$link=$newsStory[$i]->link;
$desc=$newsStory[$i]->description;
echo '<hr>';
echo 'Title:'.$title.'<br />';
//echo 'Link:'.$link.'<br />';
echo 'Description'.$desc.'<br>';
echo '<hr>';
}
?>
The XML I'm parsing:
