A powerful RSS parser which parses not only the minimum requirements of a feed but also, author, copyright, most of the Dublin Core tags, ENT(Easy News Topic), rvw, images, and enclosures. visit http://deecodameeko.com/code.
By : deecodameeko
<?
/****************************************************************************************************************** *Date: October 21, 2004 *Author: Dan Cochran * *Description: This will gather all basic information contained in a rss feed. Along with basic functionality, * the RSSParser will also parse most commonly used Dublin Core tags along with enlcosure attributes, * Well-Fomed comments RSS tag, image, and rvw tags. It will also recover ENT(Easy News Topic) tags as well. * Please see the example at the bottom to see how to use the class. and most importantly , have fun! * *email me with question or comments/bugs @ dan@deecodameeko.com * *URL: http://deecodameeko.com/code * *//sample implementation the class * *$rs = new RSSParser(); //create a new instance *$rs->parse($url_or_filename, $rs); *$rss['channel'] = $rs->get_channel(); *$rss['items'] = $rs->get_items(); *$rss['image'] = $rs->get_image(); *$rss['rvws'] = $rs->get_rvw(); *$rss['ratings'] = $rs->get_rating(); *$rss['textinput'] = $rs->get_textinput(); * *print_r($rss["channel"]); *print_r($rss["items"]);*/ * *Disclaimer: *Copyright (C) 2005 Dan Cochran * *This program is free software; you can redistribute it and/or *modify it under the terms of the GNU General Public License *as published by the Free Software Foundation; either version 2 *of the License, or (at your option) any later version. * *This program is distributed in the hope that it will be useful, *but WITHOUT ANY WARRANTY; without even the implied warranty of *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *GNU General Public License for more details. * *You should have received a copy of the GNU General Public License *along with this program; if not, write to the Free Software *Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************************************************/
class RSSParser{
var $insideitem = false; var $insideimage = false; var $insidervw = false; var $insiderating = false; var $insidetext = false; var $url = ""; var $enclosure = ''; var $ent = array();
var $cTitle, $cLink, $cDesc, $cLanguage, $cCopyright, $cManageEditor, $cWebmaster, $cLastBuild, $cRating, $cDocs, $cCategory, $cGenerator, $cPubDate; var $imTitle, $imUrl, $imLink, $imWidth, $imHeight; var $iTitle, $iLink, $iDesc, $iAuthor, $iComments, $iEnclosure, $iGuid, $iPudDate, $iSource, $iCloud; var $iCategory = array(); var $rvLink; var $dcIdentifier, $dcType, $dcTitle, $dcCreator, $dcPublisher, $dcDate, $dcmin, $dcmax, $dcvalue, $dcContributor, $dcFormat, $dcSubject, $dcSource, $dcLanguage, $dcRelation, $dcCoverage, $dcRights, $dcDescription; var $contenEncoded, $wfwComment; var $tTitle, $tLink, $tDesc, $tName; var $i; //counter var $result;
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.