phpeter Posted October 7, 2010 Share Posted October 7, 2010 Hi guys! I'm trying to parse an RSS feed using SimpleXML, but I'm having trouble :'( lol Here's my code: $feed = file_get_contents("http://engadget.com/rss.xml"); $xml = new SimpleXMLElement($feed); echo $xml->rss->channel->item[0]->title; I'm expecting it to echo the title of the first item in the RSS feed, but when I run it, I just see a blank page. Tell me what I'm doing wrong! Link to comment https://forums.phpfreaks.com/topic/215376-simplexml-trouble/ Share on other sites More sharing options...
Adam Posted October 7, 2010 Share Posted October 7, 2010 You just need: echo $xml->channel->item[0]->title; Link to comment https://forums.phpfreaks.com/topic/215376-simplexml-trouble/#findComment-1120003 Share on other sites More sharing options...
phpeter Posted October 7, 2010 Author Share Posted October 7, 2010 /that worked, awesome! Thank you so much! Link to comment https://forums.phpfreaks.com/topic/215376-simplexml-trouble/#findComment-1120008 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.