XML problem

I am running this code in my localhost but I get plenty of error, I am new with this xml.

$url = 'http://rss.sitepoint.com/f/sitepoint_blogs_feed'; 
    $xml = simplexml_load_file($url); $channel = $xml->channel; 
   echo "Title: ", (string) $channel->title, "\n",
   "Description: ", (string) $channel->description, "\n",
   "Link: ", (string) $channel->link, "\n"; 
 foreach ($channel->item as $item) { 
     echo "Item: ", (string) $item->title, "\n",
     "Link: ", (string) $item->link, "\n",
     "Description:\n", (string) $item->description, "\n";
 }

Warning: simplexml_load_file(http://rss.sitepoint.com/f/sitepoint_blogs_feed): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\wamp\www\testxml\xml\simplexml.php on line

Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://rss.sitepoint.com/f/sitepoint_blogs_feed" in C:\wamp\www\testxml\xml\simplexml.php on line 10

Notice: Trying to get property of non-object in C:\wamp\www\testxml\xml\simplexml.php on line 10

Thank you in advance.

http://rss.sitepoint.com/f/sitepoint_blogs_feed

Feed Unavailable
Feed Error

The feed you've requested is no longer available at this URL. Please visit the publisher's site and update your feed settings. 

Try
http://www.sitepoint.com/community/t/xml-problem/191462.rss

Thank you I think it works I get the response now. I am just curios why is it we put “.rss” ?

Thank you in advance.

Discourse has a lot of “discoverable power user” features.

For examples
You can get most pages in JSON format by appending “.json” to the URL
You can filter some lists by appending “?max_posts=1”
http://www.sitepoint.com/community/latest?max_posts=1

can I ask ? how they do that if we append .json we can get the response of json format if we append .rss we can get the response.

Thank you in advance.

It has to do with MVC (Model View Controller)

Not an exact explanation, but hopefully will be close enough.
Discourse uses Ruby to give JSON to Ember
Depending on the Routing (Controller) The same JSON (Model) is served in different formats (View)

Learning MVC can be steep, but well worth it. The same data can be used for many different things. eg.
Desktop
Mobile
Email
RSS
JSON
other?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.