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! Quote 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; Quote 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! Quote Link to comment https://forums.phpfreaks.com/topic/215376-simplexml-trouble/#findComment-1120008 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.