catalyst2 community forums  

Go Back   catalyst2 community forums > Support > Scripting Support

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old 12-11-2007, 03:22 PM   #1 (permalink)
Registered User
 
Join Date: Jun 2003
Location: Kingston
Posts: 32
CGI Error

Hi,

I'm trying to use SimplePie RSS to display a feed on my site. I have found some sample code on their site and tried to use it, however I keep getting the same error:

Code:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.
The page is: http://mylesnoton.com/feed.php and I'm running on Windows / IIS

This is the code I am using. I've got the same code to work on another (linux) server on C2.

Code:
<?php 
ini_set('display_errors', "1");
ini_set('error_reporting', E_ALL ^ E_NOTICE);

// Make sure SimplePie is included. You may need to change this to match the location of simplepie.inc.
require_once('includes/simplepie.inc');
 
// We'll process this feed with all of the default options.
$feed = new SimplePie('http://simplepie.org/blog/feed/');
 
// This makes sure that the content is sent to the browser as text/html and the UTF-8 character set (since we didn't change it).
$feed->handle_content_type();
 
// Let's begin our XHTML webpage code.  The DOCTYPE is supposed to be the very first thing, so we'll keep it on the same line as the closing-PHP tag.
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
        "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<title>Sample SimplePie Page</title>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body>
 
	<div class="header">
		<h1><a href="<?php echo $feed->get_permalink(); ?>"><?php echo $feed->get_title(); ?></a></h1>
		<p><?php echo $feed->get_description(); ?></p>
	</div>
 
	<?php
	/*
	Here, we'll loop through all of the items in the feed, and $item represents the current item in the loop.
	*/
	foreach ($feed->get_items() as $item):
	?>
 
		<div class="item">
			<h2><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h2>
			<p><?php echo $item->get_description(); ?></p>
			<p><small>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?></small></p>
		</div>
 
	<?php endforeach; ?>
 
</body>
</html>
Can anyone shed some light on why it doesn't seem to be working?

Thanks
Myles
internalerror is offline   Reply With Quote
Old 13-11-2007, 02:04 PM   #2 (permalink)
Bring me your problems :p
 
paulredpath's Avatar
 
Join Date: Jan 2003
Location: /dev/ahhhhhhhhh
Posts: 3,537
Myles,

Please try that now, seems simplepie needs the 'iconv' module loaded.

Nice site btw
paulredpath is offline   Reply With Quote
Old 13-11-2007, 04:58 PM   #3 (permalink)
Registered User
 
Join Date: Jun 2003
Location: Kingston
Posts: 32
Hi Paul,

That works great! Thanks for fixing it

Your a life saver
internalerror is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 12:54 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.