XML / Php Read XML, Parse, Output

magneto239

New Member
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?\[code\]<?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 Storiesfor($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>';}?>\[/code\]The XML I'm parsing:
oIe7O.png
 
Back
Top