<?php // Include the SimplePie library, and the one that handles internationalized domain names.// require_once('/feeds/php/simplepie.inc');// require_once('/feeds/idn/idna_convert.class.php');require_once('../simplepie.inc');// Create a new instance of the SimplePie object$feed = new SimplePie();// Make sure that page is getting passed a URLif (isset($_GET['feed']) && $_GET['feed'] !== ''){ // Strip slashes if magic quotes is enabled (which automatically escapes certain characters) if (get_magic_quotes_gpc()) { $_GET['feed'] = stripslashes($_GET['feed']); } $feeds = array('http://blog.spot-design.net/category/portfolio/feed/'); // XML dump $feed->enable_xml_dump(isset($_GET['xmldump']) ? true : false);}// Allow us to change the input encoding from the URL string if we want to. (optional)if (!empty($_GET['input'])){ $feed->set_input_encoding($_GET['input']);}// Allow us to cache images in feeds. This will also bypass any hotlink blocking put in place by the website.if (!empty($_GET['image']) && $_GET['image'] == 'true'){ $feed->set_image_handler('http://spot-design.net/fanlists/feeds/handler_image.php');}// When we set these, we need to make sure that the handler_image.php file is also trying to read from the same cache directory that we are.$feed->set_favicon_handler('http://spot-design.net/fanlists/feeds/handler_image.php');// Initialize the feed.$feed->init();// How many items per feed should we try to grab?$items_per_feed = 5;// As long as we're not trying to grab more items than the feed has, go through them one by one and add them to the array.for ($x = 0; $x < $feed->get_item_quantity($items_per_feed); $x++){ $first_items[] = $feed->get_item($x);}// Make sure the page is being served with the UTF-8 headers.$feed->handle_content_type();?><div class="newsblocks"> <?php // Let's loop through each item in the feed. foreach($feed->get_items() as $item): // Let's give ourselves a reference to the parent $feed object for this particular item. $feed = $item->get_feed(); ?> <h2><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h2> <div class="news-date"><?php echo $item->get_date('j M Y g:i a'); ?></div> <div class="news-story"><?php echo $item->get_content(); ?></div> <?php endforeach ?> <p>Displaying <?php echo $feed->get_item_quantity(); ?> most recent entries from Portfolio Category feed from my blog: <a href="http://blog.spot-design.net">Blogging Life as it Comes</a>.</p></div>