Page 1 of 1

Reading RSS

Posted: Mon Jul 16, 2007 7:40 pm
by tecktalkcm0391
Does anybody know of something already build, or something easy to build to read this:

Code: Select all

  <?xml version="1.0" ?> 
- <rss version="2.0">
- <channel>
  <title>Colorado Results from SuperPages.com</title> 
  <link>http://www.superpages.com/cities/CO.html</link> 
  <description>Colorado Results from SuperPages.com: Yellow Pages, White Pages, and Online Directories</description> 
  <language>en-us</language> 
  <pubDate>Mon, 16 Jul 2007 16:35:02 CST</pubDate> 
- <item>
  <title>Results for Saturday, 7/14/07</title> 
  <link>http://www.superpages.com/cities/CO.html</link> 
  <description>The winning results for Saturday, 7/14/07 are: 2, 5, 6, 25, 28. Brought to you by http://www.SuperPages.com. 
  <pubDate>Sat, 14 Jul 2007 23:15:06 CST</pubDate> 
  </item>
- <item>
  <title>Results2 for Saturday, 7/14/07</title> 
  <title>Results2 for Saturday, 7/14/07</title> 
  <link>http://www.superpages.com/cities/CO.html</link> 
  <description>The second winning results for Saturday, 7/14/07 are: 2, 5, 6, 25, 28. Brought to you by http://www.SuperPages.com. 
  <pubDate>Sat, 14 Jul 2007 23:15:23 CST</pubDate> 
  </item>
  </channel>
  </rss>

Posted: Mon Jul 16, 2007 7:53 pm
by hawleyjr
PHP 4 or PHP 5?

Posted: Mon Jul 16, 2007 7:55 pm
by tecktalkcm0391
PHP 5 is fine.

Posted: Tue Jul 17, 2007 10:55 am
by mikeeeeeeey
Try SimpleXML, it's pretty cool since its so simple (hence the name) to read XML.

Here's something I was playing around with the other day for reading the basic weather information from http://www.theweathernetwork.com/
on their RSS read:

Code: Select all

$xml = simplexml_load_file('http://rss.theweathernetwork.com/weather/gbxx0005');
$dc = $xml->children();
//$article['creator'] = $dc->creator;
echo "<span style=\"font-size: 28px; color: #333333\">" . $dc->channel->title . "</span>";
echo "<br/><br/>";
echo $dc->channel->item->description;
Before anyone gets scared, theres no classes or anything going on there. It really is that simple. The only bits you'll need to mess with are outputting the information, I'm picking specific parts from this since they're all I need.
You may need to output all the feed, or other bits, so look up some schema or some xPath to see what you can do.

Hope it helps