CNN RSS Feed available, now in PHP!
Date: Friday, June 06, 2003 @ 15:05:07 CDT
Topic: Misc PHP Nuke Stuff


Well, for those of you that downloaded the PERL version of the CNN RSS news feed, but had trouble (your ISP didn't allow PERL scripts, etc), the solution is here...

This is a simple PHP script (get it here) that will scan CNN for the latest headlines and print each section to an XML file:
  • CNN_BUSINESS_from_CNNmoney.com.xml
  • CNN_SPORTS_from_SI.com.xml
  • CNN_WEATHER.xml
  • CNN_ENTERTAINMENT.xml
  • CNN_TECHNOLOGY.xml
  • CNN_WORLD.xml
  • CNN_HEALTH.xml
  • CNN_TOP_STORIES.xml
  • CNN_POLITICS.xml
  • CNN_TRAVEL.xml
  • CNN_SPACE.xml
  • CNN_US.xml
To use it, simply put the file in your home directory (preferably not in your web site directory), and alter the following line:
var $XML_DIRECTORY = "/home/httpd/htdocs/CNN/";

Change that value to whatever directory in which you want to have your XML files stored (make sure the directory is inside your web page directory, and that you create it before running the script). To use it, simply create a cron job ("crontab -e") to execute this PHP script at a given interval. To have it execute every 30 minutes, you'd type:
*/30 * * * * PHP /your_directory/myRSS.php

That's it. Now, just create a new block, and make it read the XML file for the news headlines.





This article comes from NukedGallery
http://www.nukedgallery.net

The URL for this story is:
http://www.nukedgallery.net/modules.php?name=News&file=article&sid=17