Location: PHPKode > scripts > Ray Feed Reader > ray-feed-reader/example.php
<?php
	
	ini_set('display_errors', 1);
	
    require_once('rayfeedreader.php');
    
    /**
     * Example Usage of RayFeedReader
     */

    /**
     * get data from a feed url
     */
    $options = array('url' => 'http://raynux.com/blog/feed/');

    $feedData = RayFeedReader::getInstance($options)->parse()->getData();
	
    // Or options can be set anytime using setOptions method.
    $feedData = RayFeedReader::getInstance()->setOptions($options)->parse()->getData();
	//var_export($feedData);
	
    /**
     * Get html widget
     */

    $options = array(
                        'url' => 'http://raynux.com/blog/feed/',
                        'widget' => 'RayFeedWidget',
                    );
    
    /**
     * Load rayFeedWidget class file
     */
    require_once('rayfeedwidget.php');

    $html = RayFeedReader::getInstance()->setOptions($options)->parse()->widget();
	echo $html;
	
    // OR with widget options.
    $widgetOptions = array('widget' => 'detail', 'showTitle' => true);
    
    $html = RayFeedReader::getInstance()->setOptions($options)->parse()->widget($widgetOptions);
	echo $html;
	
    /**
     * Full options
     */
    $options = array(
                        'url' => 'http://raynux.com/blog/feed/atom/',
                        'widget' => 'RayFeedWidget',
                        'httpClient' => 'rayHttp',
                        'type' => 'atom',
                    );

    /**
     * Load rayHttp class file.
     * 
     * download the rayhttp.php class file from rayHttp package of phpclasses.org website.
     */
    require_once("rayhttp.php");    

    /**
     * Html widget with full options
     */
    $html = RayFeedReader::getInstance()->setOptions($options)->parse()->widget();
	echo $html;

    /**
     * Get Feed Data with full options
     */
    $feedData = RayFeedReader::getInstance($options)->parse()->getData();
	//var_export($feedData);
?>
Return current item: Ray Feed Reader