Jump to content

SimpleXML Trouble


phpeter

Recommended Posts

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!  :confused:

Link to comment
https://forums.phpfreaks.com/topic/215376-simplexml-trouble/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.