Extension talk:RSS Reader

From mediawiki.org

Working around firewall/proxy issues[edit]

You may have to use a proxy server to access sites outside of your firewall if you see the following error:

Error: It's not possible to get http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml


You can do this by adding the following function to lastRSS.php (taken from http://techrepublic.com.com/5208-10878-0.html?forumID=10&threadID=143268&messageID=1585447):

    function readUrl ($url, $proxy = null, $port = 80)
    {
      $content = '';

      if ( empty($proxy) )
      {
        // Open URL directly
        $fp = fopen ($url, 'r');
        if (!$fp)
        {
          return false;
        }
        while(!feof($fp))
        {
          $content = $content . fread($fp,4096);
        }
        fclose($fp);

      } else {
        // Open proxy
        $fp = fsockopen($proxy, $port);
        if (!$fp)
        {
          return false;
        }
        // Invoke URL via proxy
        fputs($fp, "GET $url HTTP/1.0\r\nHost: $proxy\r\n\r\n");
        while(!feof($fp))
        {
          $content = $content . fread($fp,4096);
        }
        fclose($fp);
        // Strip headers
        $content = substr($content, strpos($content,"\r\n\r\n")+4);
      }
      return $content;
    }

You will also need to change the following lines:

if ($f = @fopen($rss_url, 'r')){
            $rss_content = '';
            while (!feof($f)) {
                $rss_content .= fgets($f, 4096);
            }
            fclose($f);

to

if ($rss_content=$this->readUrl($rss_url,'yourProxyServer',yourProxyPort)){

Many notices appearing[edit]

Notice: Use of undefined constant lastRSS - assumed 'lastRSS' in \wiki\extensions\RSSReader\RSSReader.php on line 52

Notice: Undefined index: time in \wiki\extensions\RSSReader\RSSReader.php on line 107

Notice: Undefined index: desc in \wiki\extensions\RSSReader\RSSReader.php on line 123

Notice: Undefined variable: output in \wiki\extensions\RSSReader\RSSReader.php on line 138

Notice: Use of undefined constant lastRSS - assumed 'lastRSS' in \wiki\extensions\RSSReader\RSSReader.php on line 146

Warning: Cannot modify header information - headers already sent by (output started at \wiki\extensions\RSSReader\RSSReader.php:52) in \wiki\includes\WebResponse.php on line 10

(but there aren't any trailing spaces!)

Svanslyck 06:32, 24 February 2008 (UTC)Reply

These are notices, due to the configuration of your web server (actually also a coding problem, because this notice should be avoided with an isset clause). In order to make them disappear, just type this at the beginning your RSSReader.php script:

# Disable notices
error_reporting(E_ALL ^ E_NOTICE);

I changed the code to test it properly with isset, and kept options "channeldesc" and "itemdesc" because I need these two features separate.

<?php
/* RSSReader 0.2.5 - a parser hook for MediaWiki
 * Copyright © 2008  Artem Kaznatcheev
 *
 * 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, see <http://www.gnu.org/licenses/>.
 */

# Not a valid entry point, skip unless MEDIAWIKI is defined
if ( !defined('MEDIAWIKI') ) {
        exit( 1 );
}

$wgExtensionFunctions[] = 'efRSSReader';

$wgExtensionCredits['parserhook'][] = array(
        'name' => 'RSS Reader',
        'version' => '0.2.5',
        'author' => 'Artem Kaznatcheev, Andrea Matsunaga',
        'description' => 'Adds <tt><rss></tt> tag',
        'url' => 'http://www.mediawiki.org/wiki/Extension:RSS_Reader'
);

### Global Variables ###
//path to follow for server scripts
$egRSSReaderPath  = $wgScriptPath."/extensions/RSSReader";
$egCacheTime      = 3600; //default cache time in seconds
$egCacheTimeMin   = 1800; //minimum cache time in seconds
$egCacheTimeMax   = 7200; //maximum cache time in seconds
$egCache          = true; //boolean to determine if caching should be done
//boolean to determine if links created should have rel="nofollow"
$egNoFollow       = false;
$egWidthMin       = 200;  //minimim width in pixels
$egWidthMax       = 800;  //maximum width in pixels

/**
 * select if cURLRSS or wikiRSS or lastRSS should be loaded
 * set rssType to the proper object type
 * each object of rssType must have the same interface
 */
if (file_exists(dirname(__FILE__)."/cURLRSS.php")){
  require_once(dirname(__FILE__)."/cURLRSS.php"); //loads cURLRSS.php
  $rssType = new cURLRSS; //set rssType to cURLRSS
} else if (file_exists(dirname( __FILE__ )."/wikiRSS.php")) {
  require_once(dirname( __FILE__ )."/wikiRSS.php"); //loads wikiRSS.php
  $rssType = new wikiRSS; //set rssType to wikiRSS
} else if (file_exists(dirname( __FILE__ )."/lastRSS.php")) {
  require_once(dirname( __FILE__ )."/lastRSS.php"); //loads lastRSS.php
  $rssType = new lastRSS; //set rssType to lastRSS
} else {
  trigger_error("RSSReader is not properly set-up:".
    "need cURLRSS, wikiRSS or lastRSS");
}

function efRSSReader() {
  global $wgParser;
  $wgParser->setHook( 'rss', 'efCreateRSSReader' );
}

function efCreateRSSReader($input, $argv, &$parser) {
  global $wgOut, $egRSSReaderPath, $egCacheTime, $egCacheTimeMin,
    $egCacheTimeMax, $egCache, $rssType, $egNoFollow, $egWidthMin,
    $egWidthMax;

   //disable cache so feed is fetched everytime page is visited
  $parser->disableCache();

  $output = '';
  if (isset($input)) {
    $fields = explode("|",$input); //get the urls between the tags
    /*
     * Check if a "number=n" argument has been provided
     * if it has and is an int, then set the $number field to the proper
     * value else set $number field to zero (which means "all available")
     */
    $number = 0; //set default if no argument has been provided
    if (isset($argv["number"])) { //check if argument has been provided
      //check if argument is an integer
      if ((int)$argv["number"]."" == $argv["number"]) {
        $number = $argv["number"]; //set $number field
      }
    }

    /*
     * Check if a "width=n" argument has been provided
     * if it has and is an int, then set the $width field to the proper
     * value else set $width field to zero (which means "no width")
     */
    $width = 0; //set default if no argument has been provided
    if (isset($argv["width"])) { //check if argument has been provided
      //check if argument is an integer
      if ((int)$argv["width"]."" == $argv["width"]) {
        if (($argv["width"]>=$egWidthMin)&&($argv["width"]<=$egWidthMax)) {
          $width = $argv["width"]; //set $width field
        }
      }
    }

    /*
     * Check if a "time=n" argument has been provided
     * if it has and is between $egCacheTimeMin and $egCacheTimeMax
     * then set $cacheTime to the value
     * else set $cacheTime to $egCacheTime (the default CacheTime)
     */
    $cacheTime = $egCacheTime; //set default if no argument has been provided
    if (isset($argv["time"])) { //check if argument has been provided
      //check if argument is an integer
      if ((int)$argv["time"]."" == $argv["time"]) {
        //check if argument is in range
        if (($argv["time"]>=$egCacheTimeMin)
          &&($argv["time"]<=$egCacheTimeMax)) {
          $cacheTime = $argv["time"]; //set $cacheTime field
        }
      }
    }

    /* Check if a "itemdesc=off" parameter has been provided and set */
    $itemdesc = true; //set the default
    if (isset($argv["itemdesc"])) { //check if argument has been provided
      if ($argv["itemdesc"]=="off") $itemdesc = false;
    }

    /* Check if "title=off" parameter was provided and set dispTitle */
    $dispTitle = true; //set the default
    if (isset($argv["title"])) { //check if argument has been provided
      if ($argv["title"]=="off") $dispTitle = false;
    }

    /* Check if a "channeldesc=off" parameter has been provided and set */
    $channeldesc = true; //set the default
    if (isset($argv["channeldesc"])) { //check if argument has been provided
      if ($argv["channeldesc"]=="off") $channeldesc = false;
    }

    $wgOut->addScript('<link rel="stylesheet" type="text/css" href="'.
      $egRSSReaderPath.'/RSSReader.css" />'); //add CSS

    if (!$width) {
      $output .= '
        <table id="RSSMainBody">
        <tr>
      ';
    } else {
      $output .= '
        <table id="RSSMainBody" style="float:right;width:'.$width.'">
        <tr>
      ';
    }

    //calculates the desired width for each feed and makes sure it is int
    $width = intval(100/sizeof($fields) - 5);

    // Create cURLRSS or wikiRSS or lastRSS object
    $rss = new $rssType; //initialize an object of rssType
    // Set public variables
    if (($rssType instanceof lastRSS)&&($egCache)){
      $rss->cache_dir = dirname( __FILE__ ).'/cache/'; //directory of cache
    }
    $rss->cache = $egCache; //cache attribute
    $rss->cache_time = $cacheTime; //refresh time in seconds
    $rss->date_format = 'l';

    foreach ($fields as $field) {
      $field = trim($field);
      if (!preg_match('/^http[s]?:\/\//', $field)) {
        continue;
      }
      wfDebug("RSSReader feed: ".$field."\n");
      //table cell that contains a single RSS feed
      $output .= '<td valign="top" style="width: '.$width.'%;">';
      if ($rssArray = $rss->get($field)){
        if ($dispTitle && isset($rssArray['title'])) { //check if title should be displayed
          $output .= '<div class="RSSReader-head"><h3>';
          if (isset($rssArray['link'])) {
            $output .= '<a href="'.$rssArray['link'].'"';
            //decide if nofollow is needed
            if ($egNoFollow) $output .= ' rel="nofollow"';
            $output .= '>'.$rssArray['title'].'</a>';
            wfDebug("RSSReader title: ".$rssArray['title']." Link: ".$rssArray['link']."\n");
          } else {
            $output .= $rssArray['title'];
            wfDebug("RSSReader title: ".$rssArray['title']."\n");
          }
          $output .= '</h3>';
          //decide if description is required
          if ($channeldesc && isset($rssArray['description'])) $output .= $rssArray['description'];
          $output .= '</div>';
        }

        /* Outputs the items */
        if (isset($rssArray['items'])) {
          $output .= '<ul>';
          $i = 0; //counter for number of items already displayed
          foreach ($rssArray['items'] as $item){
            $output .= '<li><a href="'.$item['link'].'" ';
            //decide if nofollow is needed
            if ($egNoFollow) $output .= 'rel="nofollow"';
            $output .= '>'.$item['title'].'</a>';
            if ($itemdesc && isset($item['description'])) {
              $output .= "<br />\n".preg_replace('/[\r\n]/', "", html_entity_decode($item['description']))."\n";
            }
            $output .= "</li>";
            $i += 1;
            /*if reached the number of desired display items stop working on
             *displaying more items*/
            if ($i == $number) { break; }
          } //close foreach items
          $output .= '</ul>';
        }
      } else { //output error if not possible to fetch RSS
        $output .= "Error: It's not possible to get $field...";
      }
      $output .= '</td>';
    } //close foreach fields
    $output .= "</tr></table>";
  } //close main "else"
  return $output;
}

Fatal error in Mediawiki 1.11[edit]

Does anyone have this working on MediaWiki 1.11 . All I get is

Fatal error: Class name must be a valid object or a string in .../extensions/RSSReader/RSSReader.php on line 144

--Valkyrie 03:47, 13 December 2007 (UTC)Reply

You need to install also lastRSS, follow the instruction.

Strange Issue[edit]

When I install this extension, the code of lastRSS.php appears at the top of my wiki, below the tabs and with the icon on top of it, but above the content and sidebar.as well as this I cannot submit edits to any pages. ^^^ above unsigned comment, contributed by User:12Ghost12

Can you link me to the error or send a screen capture? As well as tell me your version of PHP and Mediawiki, also, how did you install the extension. For some reason I think its probably an error with how the extension was installed, or how your PHP handled it. --DFRussia 00:40, 7 October 2007 (UTC)Reply

I installed the extension by following the instructions on the extension page. I am using MediaWiki 1.10.0 and PHP 5.1.4.

image

Hmm, that's weird (sorry for the slow response, just noticed the image). Well, check for some little things like extra whitespace after the closing PHP tag "?>" and that all the PHP tags are present everywhere the should be "<?php" at the start of the file and "?>" as the very last thing in a file. --DFRussia 16:10, 6 November 2007 (UTC)Reply

FYI I got the same problem when I used wget to get the lastRSS.phps file, due to all the escaping. (duh)... Cutting/pasting the code workinged fine.

Mine did this as well. Not in Firefox, but in IE7. What you need to do is just remove the commented css-code at the bottom of the php file. Then everything will be back to normal. --Kev 12:25, 17 February 2009 (UTC)

Extension rocks![edit]

this extension totally rocks! installed it at http://www.phatnav.com/w/index.php?title=RSSTest --Wikiexpert 01:59, 2 August 2007 (UTC)Reply

How can i uninstall this extension !???[edit]

After first time running, now a can´t use the orignal RSS-feed-function from Wiki (last changes in rss format)!!

  • This extension turns off parser caching for all the pages on which the <rss> tag is present. This could result in server strain if rss tags are present on many high traffic pages.

How can i make this reverse / turn the parser on ? Thanks, bye

You can refer to the install page for install instructions. If you follow those word for word, the extension should install. If you don't want to turn of parser caching, then comment out the line:
$parser->disableCache();
. However, be warned if your do not disable caching, you will defeat the purpose of having an RSS feed, since the feed will only updated when someone modifies that page (since MediaWiki will cache it until then). I strongly discourage turning cache back on, if you are afraid the re-rendering might cause strain, then make a special page for the RSS feed and don't have any other hard to re-render content on that page. I am not sure what you mean by "After first time running, now a can´t use the orignal RSS-feed-function from Wiki (last changes in rss format)!!". What original RSS feed function can't be used? Can you link me to where you test this so I can have a look around? I hope this helped --DFRussia 16:25, 3 August 2007 (UTC)Reply

Extension is working fine[edit]

The RSS Reader Extension is working fine for me on MediaWiki 1.10.1, and I haven't discovered the side effects mentioned above. What I definitely like is that I don't need to install external helper applications like Magpie (that might not be available for my system).

I'm using this Extension to announce new pages and recent edits on my Wikis (side by side in two column layout), and to embed new articles from a Drupal site into the Wiki (one column); vice versa, in Drupal I'm publishing the new pages and recent edits feeds from the Wiki. It's not a real "integration" of both systems, but at least we see what is going on in different parts of the site - that's quite an enhancement, I think.

However, the (lack of) caching is a little drawback; the MediaWiki front page now takes approx. seven seconds to load (opposed to 1-2 secs without fetching the feeds from itself). As far as I understand, Drupal uses a different approach and fetches the feeds only in configurable intervals (depending on the feeds, we're using refreshing intervals between 15 minutes and 24 hrs.). A little caching would widen the possible uses for RSS Reader, at least in our environment (e.g. for matching MediaWiki categories with RSS feeds for the matching Drupal taxonomy terms or something like this).

What I couldn't figure out yet is where the feeds decriptions (headings/subheadings) are configured; the subheading description for the Recent Changes seems to be MediaWiki:recentchanges-feed-description, the subheading description for new pages seems to derive from MediaWiki:tagline; I have no idea where the descriptions for the headings come from (this might be off-topic since most probably I'm the only one using an RSS Reader Extension to announce changes in MediaWiki itself ;). --asb 13:57, 8 August 2007 (UTC)Reply

I am glad you are enjoying the extension. My next modification for it is improving and benchmarking the caching. It should do SOME caching now, but I will do my best to improve it and make it actually usefull. I also plan into seeing if it is possible to pseudo-disable parser caching, but I do not think much is possible on that front. I also plan to include some sort of "self" reference to shortcircuit the system to avoid the RSS Reader from honestly fetching the info about its own wiki, since it should be able to get it from the PHP without even honestly fetching it. I have another project I am working on now, but I still try to update this one from time to time, so check back for improvements. (Also, if you want me to try to consider specific cases, link me to your wiki). Oh, and ofcourse, feel free to make requests for improvements. --DFRussia 16:57, 8 August 2007 (UTC)Reply
Your plans sound pretty cool, and take your time, there is no hurry.
I will gladly make suggestions for improvements if they occur to me, but currently RSS Reader does exactly what it is supposed to do, and so far even without any glitches ;-) --20:18, 8 August 2007 (UTC)

I just wanted to add a ditto. I installed it a few hours ago. I don't have it on main pages but wanted to see how it would look on its own pages and stuck it on pages that go about three in if you're clicking through like [www.fanhistory.com/index.php/Harry_Potter_fandom_on_rss this one here] and looks pretty good so far. Very nice option to have, even if I don't use it much more beyond a few random pages mostly like an rss Reader. --PurplePopple 02:44, 19 August 2007 (UTC)Reply

If rss time<$egCacheTimeMin, the whole page goes blank[edit]

I noticed that if the <rss time=n> is out-of-range compared to the settings, the page with the wrong time is not rendered at all. This means only someone with rights to edit LocalSettings.php could fix the problem. The site is using MediaWiki 9.3 on IIS. --DoSiDo 00:24, 15 September 2007 (UTC)Reply

Thank you for the comment DoSiDo. I will see what is the problem and I will hopefully have it fixed in the next release. I do not have MediaWiki 9.3 installed to test it on, and I am not sure if I want to install it... but if you are interested in helping out, it'd be great if you offered to test the code :P (although I might change my mind and just install 9.3) --DFRussia 03:04, 15 September 2007 (UTC)Reply
I can't observe the error in 1.10.... which means it is probably some difference in the language most likely, since the code that checks the the time values does not use any mediawiki functions... only PHP. What version of PHP are you running? --DFRussia 04:40, 15 September 2007 (UTC)Reply

Sometimes[edit]

Sometimes it works. Sometimes it doesn't. I occasionally get "Warning: strtotime() [function.strtotime]: Called with an empty time parameter. in /home/fandomin/public_html/extensions/RSSReader/lastRSS.php on line 159" on pages like [www.fanhistory.com/index.php/CSI_stories_on_rss this] and other times, I do not. --PurplePopple 13:47, 27 September 2007 (UTC)Reply

Weird. This is an error is lastRSS, I did not write lastRSS so I can't tell you off the top of my head, but ofcourse I will look into it and try to fix your problem. Can you give me some information about the version of PHP and MediaWiki you are using? Thank you. --DFRussia 14:12, 2 October 2007 (UTC)Reply
Heehee, nevermind. I checked your talk paged and I've pointed that out before. You have recent version of both PHP and MediaWiki. I think it is either a server time issue (like I mentioned on your talk page) or maybe a lastRSS issue. I will try to look over lastRSS and see what could be causing the problem, but it will be hard for me to fix, since I can not observe the bug on my own system. --DFRussia 14:15, 2 October 2007 (UTC)Reply
-I was having the same issue and then I synced up the clocks in my user preferences "date & time" page. Problem solved!

Nofollow Tag[edit]

Excellent extension. Works very well for us. Is it possible though to add a NoFollow tag to external links displayed here?

  • Do you mean the links inside this page on MediaWiki, or do you mean the links in general created by this extension on your site? I can add that if that is what you want. --DFRussia 02:43, 1 October 2007 (UTC)Reply

Question from my Talk[edit]

This is a question from my talk page, posted by 202.156.11.2 and my answer:

How can i display the first few content of my feed? not just the title of my feed.

  • By default, the extension should show both the title of the feed and the titles of the last few entries. If you want an entry summary for each item in the feed, that is not currently implemented (since I did not need/want it for what I was doing) but I can implement it (and was planning to anyways) in the next version. I hope you are enjoying the extension, if I misunderstood your concern please post more here --DFRussia 02:48, 1 October 2007 (UTC)Reply

$wgOut->addScript working?[edit]

Does this line:

$wgOut->addScript('<link rel="stylesheet" type="text/css" href="'.$egRSSReaderPath.'/RSSReader.css" />'); //add CSS

seem to be working for anyone? I would just soon comment it out, actually. (Comment Added by User:Jclerner)

Are you having issues with that line? I had some issues with the function when I was coding another extension (that I haven't put up on Media Wiki) with it not doing exactly what I wanted.... but it never gave me a specific error or stop the general script from functioning. In other words, if you are getting an error, could you describe the error more? --DFRussia 08:08, 13 October 2007 (UTC)Reply

It doesn't seem to work with some RSS feeds...[edit]

I've tried to add some some .php and .asp RSS feeds, but it wont read them. Only the .xml files. Is there a way or fix to accept .php or .asp RSS feeds? -- Kirjapan 04:23, 18 October 2007 (UTC)Reply

I cannot get it to work with this particular feed, any ideas (great script many thanks): http://www.legalservices.gov.uk/xml/rss/cdsnewsupdates/rss.xml

For the person having issue with a particular feed, I will check that feed with my installation and see what kind of messages I get. As for Kirjapan, reading .php and .asp RSS feeds is more inside the lastRSS code. I will try to look around and see what I can do, but I doubt I will make much headway, sorry --DFRussia 00:39, 2 November 2007 (UTC)Reply
I tried out your feed, and I am getting errors too. It seems like a bug inside lastRSS, I think. I will see what I can do. --DFRussia 01:22, 2 November 2007 (UTC)Reply

I tried the above feed in WM 1.11.x and got the feed title and a list of empty bullets. -- michael^roberts^lnssi^com

Not working on my localhost site[edit]

This is my 4th attempt to find a reader that works on Mediawiki 1.11. When I install the program, add a newsfeed and then refresh the Firefox browser what I see is the lastRSS.php script. Somehow the script is read straight into the browser window and I cannnot access my site until I remove the include command. Thanks Keveen

Whoopsy. Totally gave the wrong response to the wrong person :P. Disregard the previous response (if you look it up in page history). To help you Keveen I would need a bit more info about how you include the scripts and maybe a screenshot of what is happening or a link to the wiki. Cheers --DFRussia 00:37, 2 November 2007 (UTC)Reply

Error: It's not possible to get http://www. ...[edit]

Hello,

When I try to use RSS reader on the wiki with the syntax:

Extension:RSS -- Error: "http://youtube.com/rss/global/top_favorites.rss" is not in the list of allowed feeds. The allowed feeds are as follows: https://wikimediafoundation.org/news/feed/, https://wikimediafoundation.org/category/technology/feed/, https://wikimediafoundation.org/category/technology/mediawiki/feed/, https://discourse-mediawiki.wmflabs.org/c/ask-here.rss, https://codeclimate.com/github/wikimedia/mediawiki-extensions-CentralNotice/feed.atom, https://codeclimate.com/github/wikimedia/mediawiki-extensions-DonationInterface/feed.atom, https://codeclimate.com/github/wikimedia/wikimedia-fundraising-crm/feed.atom, https://codeclimate.com/github/wikimedia/wikimedia-fundraising-dash/feed.atom, https://codeclimate.com/github/wikimedia/wikimedia-fundraising-php-queue/feed.atom, https://codeclimate.com/github/wikimedia/wikimedia-fundraising-SmashPig/feed.atom and https://codeclimate.com/github/wikimedia/wikimedia-fundraising-tools/feed.atom.

I get :

Error: It's not possible to get http://youtube.com/rss/global/top_favorites.rss

What is the problem ?

Dom 10:31, 1 November 2007 (UTC)

Hmmm, that's one of my standard error outputs, it means that your server was unable to go and fetch that feed. I checked the feed and it exists, so it might be an issue with your server's way of getting the feed. Are you able to fetch any other feeds? I will check this particular feed on my installation to see if I can fetch it. --DFRussia 00:41, 2 November 2007 (UTC)Reply
I tested the youtube feed, and it works perfectly fine. If it keeps failing, try some other feeds and tell me what happens. I think it might be a server issue for you. --DFRussia 01:19, 2 November 2007 (UTC)Reply
This issue arises if the web server is not allowing the fopen functions to connect to remote URLs. If you hack lastRSS.php, look for the following:
if ($f = @fopen($rss_url, 'r')) {
Remove the @ sign, and refresh the page. If it has a problem with fopen, it will throw an error. Nihilist 17:38, 28 January 2008 (UTC)Reply
I'm having the problem you describe, Nihilist. Do you know how to fix it? --Naught101 10:44, 29 September 2008 (UTC)Reply

Quickfix for resolving problems with displaying of special characters (e.g. German Umlaute)[edit]

Hi,

here´s a quickfix that will allow the correct representation of German Umlaute:

function repairUTF8($inputString) {
//function corrects display errors with different charsets of RSS feed sources (ISO and UTF8)
//the function manually corrects the german special characters by setting all content to UTF8 and converting special characters to HTML code

$wrongChars = array("ä","ö","ü","Ä","Ö","Ü","ß");
$correctChars = array ("& auml;","& ouml;","& uuml;","& Auml;","& Ouml;","& Uuml;","& szlig;"); //remove blank between "&" and "xxx"

$outputString = str_replace($wrongChars,$correctChars,$inputString);
$outputString = utf8_encode($outputString);
$outputString = str_replace($wrongChars,$correctChars,$inputString);

return $outputString;
}

Conflict with DPL2 Extension[edit]

I've set up RSS Reader and find it works fine, except when the DPL2 (Dynamic Page List) extension is on the same page. Then a string of errors are reported in the file RSSReader.php, as follows: undefined index on lines 74 (number), 89 (width), 107 (time); undefined variable on line 133 (output); and undefined constant (last RSS) on line 146.

--C4duser 18:08, 26 November 2007 (UTC)Reply

Apparently DPL2 is outdated and not supported, and DPL should be used instead, however I would not be suprised if DPL causes the same errors as DPL2. I will install DPL at some point and test it. I have exams and lots of work right now, so don't expect any fixes very quickly. If you have a good fix, please mention it here or on my talk page and we'll work it into the official code --DFRussia 03:22, 27 November 2007 (UTC)Reply
I am using the latest DPL version. However, this problem is not really serious for me, since I plan to use to reader on a separate subpage where DPL will not be used. A more serious problem is that the reader doesn't render properly most foreign language characters (for example, the tilde in portuguese. The same feed renders properly in Firefox or other readers, but comes out garbled in this reader. I suspect that something is wrong with the choice of encoding. Anyway, the extension is quite useful. Thanks. --C4duser 04:59, 1 December 2007 (UTC)Reply

Does not work with blogger feeds, i just get a little grey line.[edit]

For example when i use this properly formated RSS feed from blogger http://blog.shsfirst.org/feeds/posts/default all I get is a grey underline.

Persistent Inability to Access Feeds[edit]

Hi! I was playing with your extension, trying to get it to work on our new company MediaWiki instance, but I keep hitting a snag. I've followed the instructions step by step, but keep getting this error message:

Error: It's not possible to get http://www.azcentral.com/rss/feeds/news.xml...

The feed seems to be valid, and lastRSS is generating files in the cache directory, but the contents of the file seem anomalous. I have also verified that the allow_url_fopen = On is set in php.ini, which is an instance of PHP5 running on an 2K IIS server.

http://www.azcentral.com/rss/feeds/news.xml generates rsscache_5e0bee2f55dfa0373ccc86ccff12422a which contains b:0;

Any ideas?

Does this work with Bugzilla feeds?[edit]

I generate Bugzilla RSS feeds based on queries (e.g., a list of all open bugs for a given release), and want to include them in certain wiki pages. These work fine in the browser, but <rss>http://<url>/buglist.cgi?bug_id=163%2C147%2C169%2C143%2C165%2C140%2C168%2C142%2C141%2C173&field-1-0-0=bug_id&query_format=advanced&type-1-0-0=anyexact&value-1-0-0=163%2C147%2C169%2C143%2C165%2C140%2C168%2C142%2C141%2C173&title=Bug%20List:%20<queryName>&ctype=rss</rss> simply results in an empty page.

The following works fine: http://mmamania.com/feed/ . On the other hand, when I try the 'http://www.legalservices.gov.uk/xml/rss/cdsnewsupdates/rss.xml' feed (mentioned in a previous issue on this page), I just get a list of empty bullets. -- com^lnssi^roberts^michael

How to get rid of PHP Notices and Warnings?[edit]

I'm able to read RSS feeds from SourceForge but I'm getting PHP Notice messages. I'm sorry for my total ignorance on PHP, but... how can I get rid of these messages?

Thanks for this great extension!

 Notice: Undefined index: number in /var/www/wiki.jquantlib.org/extensions/RSSReader/RSSReader.php on line 74
 
 Notice: Undefined index: width in /var/www/wiki.jquantlib.org/extensions/RSSReader/RSSReader.php on line 89
 
 Notice: Undefined index: time in /var/www/wiki.jquantlib.org/extensions/RSSReader/RSSReader.php on line 107
 
 Notice: Undefined index: desc in /var/www/wiki.jquantlib.org/extensions/RSSReader/RSSReader.php on line 123
 
 Notice: Undefined variable: output in /var/www/wiki.jquantlib.org/extensions/RSSReader/RSSReader.php on line 133
 
 Notice: Use of undefined constant lastRSS - assumed 'lastRSS' in /var/www/wiki.jquantlib.org/extensions/RSSReader/RSSReader.php on line 146

-- Richard Gomes at http://www.jquantlib.org/


Oh well.... I finally found how to do it. Put the following code in the beginning of your LocalSettings.php

error_reporting(0);
ini_set("display_errors", 0);

-- Richard Gomes at http://www.jquantlib.org/

213.123.170.12 23:39, 25 January 2008 (UTC)Reply

1.7[edit]

I have mediawiki 1.7 does this extension work? If not, what extensions do? Odessaukrain 06:30, 1 February 2008 (UTC)Reply

Warning after install[edit]

I get the following warning once I installed RSS Reader. How do I resolve this?

Warning: Cannot modify header information - headers already sent by (output started at $IP/extensions/RSSReader/lastRSS.php:220) in $IP/includes/WebResponse.php on line 10

I get these also. And there is definitely no trailing whitespace in either of the two PHP files, nor the CSS file.
I am getting the exact same error, so pages only load about half the time.

Modification[edit]

If you want open Links into external Window Change Line

From

170           $output .= '<li><a href="'.$item['link'].'"';


to

170           $output .= '<li><a href="'.$item['link'].'" target="_blank" ';


Have Fun,

greetings

Flo

Hiding Feed Title[edit]

Thanks for one really great extension!

I would like to hide/not display Feed title at all. Is it feasible? If not, can one style title?, via CSS?

--- I would also like this functionality. Thanks. --jay

Getting Around allow_url_fopen[edit]

Dreamhost hosts my wiki, and they block allow_url_fopen. I looked on their wiki, and they say to use cURL to work around it, and give explanations for replacing the parts of the code that call for an external website (http://wiki.dreamhost.com/CURL_PHP_tutorial), but I can't find anything in the RSSReader.php code (or the lastRSS.php code, for that matter) that matches the "load_file", "load_string," "get_contents," etc. that it says need to be replaced. Where is the RSSReader code fetching the rss file? I don't know hardly any php, so I may be in way over my head trying to get this to work, but I thought I'd try. - Jandy

Ok, I created an alternative to lastRSS (cURLRSS) that does not require allow_url_fopen, refer to this section. I have not been able to test it properly (since I am too lazy to install the cURL library), so if you want to hack/test it and tell me any errors you get, that would be great. RSS Reader 0.2.3 does not support cURLRSS by default, you will have to make some modifications in RSS Reader 0.2.3 to load cURLRSS. Basically you will need to ensure that require_once(dirname(__FILE__)."/cURLRSS.php"); is called and that $rssType = cURLRSS; is set. I am go code RSS Reader 0.2.4 soon (hopefully today) and that will support cURLRSS without hacking. Good luck! --DFRussia 06:51, 29 March 2008 (UTC)Reply

Allow users to view an entry summary along with title[edit]

Has anyone got anything started on this "Allow users to view an entry summary along with title" improvement, or should I just start whacking at it? I'd like to add an attribute like "<rss entry=yes>" so I can see as much of the xml feed as possible. Maybe tuck it away behind some js.

This seems like the biggest step towards greatly improving this ext. --Theothertom 14:24, 8 April 2008 (UTC)Reply

I guess Nad has added this feature in 0.2.5, is this the feature you wanted? Sorry, I haven't had time to read this discussion page or code recently --DFRussia 01:21, 17 August 2008 (UTC)Reply

Using with Templates and Variables[edit]

Does anyone know how to have the <rss> tags work with embedded templates. For example I'm trying to add some google finance rss's to my page using a template:

Template:RSSTest finance.google.com/finance?morenews=10&rating=1&q={{{1}}}:{{{2}}}&output=rss

Calling the template I get the correct return value:

{{RSSTest|NASDAQ|AAPL}}

Gives the feed as expected. However, then using this to generate an RSS feed fails:

<rss>{{RSSTest|NASDAQ|AAPL}}</rss>

Gives:

Error: It's not possible to get {{RSSTest... Error: It's not possible to get NASDAQ... Error: It's not possible to get AAPL}}...

If I simply enter the non-templated rss link this RSS extension works as expected. -Thanks, James

Same problem here. I'd like to use the rss-tag in a template:
Error: It's not possible to get {{{url}}}...
see here: http://wiki.uugrn.org/wiki/Vorlage:RssBox (sorry, LANG=de) --Raphael

User Agent required while fetching RSS XML[edit]

I was trying to get a XML feed from google news

http://news.google.com/news?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hl=en&tab=wn&ned=us&q=obama&ie=UTF-8&output=rss

but ended up with

Error: It's not possible to get http://news.google.com/news?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hl=en&tab=wn&ned=us&q=obama&ie=UTF-8&output=rss

I checked with wget it was not giving me the feed, so I used -U "Mozilla Version String" and it got the feed. Is there a way around this... It would be great if we could pass on user agent string of the guy trying to view the mediawiki page to php(5)-curl.


broken after migrating to MW 1.13[edit]

works for external rss feeds , but feeds of mediawiki like specialpages:newpages are not displayed anymore:

http://192.168.1.242/mediawiki/index.php?title=Special:Newpages&feed=rss

lastRSS.php fopen() function do not manage to fopen http stream. mailto:sancelot@free.fr

MediaWiki 1.13.2
PHP 5.2.42-servage7 (apache2handler)
MySQL 5.0.51a
Same here. Upgraded in place from MW 1.11.1 to 13.1.2. External feeds come in fine, but I was really liking RSS Reader to use as an "aggregator" to list on the Main Page our 10 newest pages. (See DishiWiki.) That is, in my case, reading from our own Special:New Pages feed (http://dishiwiki.com/index.php?title=Special:Newpages&feed=rss). Does anyone have time to take a look at how we can fix this? (Really miss it.) I'm pretty sure I'm running eAccelerator. (This is a new upgrade and it's all new to me.)
Good news. Here's my workaround: I used our (free) Feedburner.com account to burn our wiki feed, then pulled that external Feedburner feed back into the wiki via RSS Reader. Works like a charm. —Brian7632416 02:05, 22 November 2008 (UTC)Reply
Belay that (above). It (workaround, above) worked for about a day. RSS Reader has always been spotty for me. Now it won't work at all. I'm gonna try a different RSS reader extension. Brian7632416 03:32, 29 November 2008 (UTC)Reply
I've fought with this extension for too long on MW 1.13 and 1.14. Problematic and unpredictable. If you are having difficulties, you might consider Extension:Widgets, and use the Feed widget. Brian7632416 06:03, 26 April 2009 (UTC)Reply

Drupal-generated RSS and Errors[edit]

We are using RSSReader and MediaWiki 1.10.1. We are attempting to use an RSS feed generated by a Drupal-powered website and we are getting errors:

PHP Notice: Undefined offset: 1 in ...extensions\RSSReader\lastRSS.php on line 155 PHP Notice: Undefined offset: 1 in ...extensions\RSSReader\lastRSS.php on line 155 PHP Notice: Undefined offset: 1 in ...extensions\RSSReader\lastRSS.php on line 155 PHP Notice: Undefined offset: 1 in ...extensions\RSSReader\lastRSS.php on line 155 PHP Notice: Undefined offset: 1 in ...extensions\RSSReader\lastRSS.php on line 155 PHP Notice: Undefined offset: 1 in ...extensions\RSSReader\lastRSS.php on line 155 PHP Notice: Undefined offset: 1 in ...extensions\RSSReader\lastRSS.php on line 155 PHP Notice: Undefined offset: 1 in ...extensions\RSSReader\lastRSS.php on line 155 PHP Notice: Undefined offset: 1 in ...extensions\RSSReader\lastRSS.php on line 155 PHP Notice: Undefined offset: 1 in ...extensions\RSSReader\lastRSS.php on line 155 PHP Notice: Undefined index: lastBuildDate in ...extensions\RSSReader\lastRSS.php on line 159 PHP Notice: Undefined index: link in ...extensions\RSSReader\RSSReader.php on line 194 PHP Notice: Undefined index: title in ...extensions\RSSReader\RSSReader.php on line 199 PHP Notice: Undefined index: description in ...extensions\RSSReader\RSSReader.php on line 202

The feed we are trying to use is this one:

The feed validates, but has a lot of yellow highlighted areas that may be causing the problem.

We tried disabling error messages as per this Talk Page, but the errors are still occurring. Is this a problem with that particular feed?

Fix for feeds in different encodings[edit]

Seems that lastRSS always output feed in the original encoding. Attached patch fixes it.

--- RSSReader.php.orig	2008-12-22 20:21:04.000000000 +0600
+++ extensions/RSSReader/RSSReader.php	2008-12-22 20:16:01.000000000 +0600
@@ -173,6 +173,10 @@
     // Create cURLRSS or wikiRSS or lastRSS object
     $rss = new $rssType; //initialize an object of rssType
     // Set public variables
+    if (is_a($rssType, 'lastRSS')) {
+      global $wgOutputEncoding;
+      $rss->cp = $wgOutputEncoding;
+    }
     if (is_a($rssType, 'lastRSS') && $egCache) {
       $rss->cache_dir = dirname( __FILE__ ).'/cache/'; //directory of cache
     }

Not sure is it required for other fetchers, but the modifications are trivial.

--MikhailGusarov 14:20, 22 December 2008 (UTC)Reply

Works for me, but don't forget to delete cache. -- Mathieugp 03:53, 16 April 2010 (UTC)Reply

Atom[edit]

Is it possible to read Atom-Feeds instead of RSS?

Example:

  • http://news.google.com/nwshp?hl=en&tab=wn&output=rss
  • http://news.google.com/nwshp?hl=en&tab=wn&output=atom

--Fonds 23:11, 21 January 2009 (UTC)Reply

Recent changes feed[edit]

Sorry if this has been asked before. I'm relatively new to MediaWiki and RSS Reader. I've just installed RSS Reader and external feeds seem to work fine however I'm having a problem with getting internal MediaWiki RSS feeds to work. I've tried adding a feed of my wiki's Recent Changes to one of my pages but it doesn't work. All I get is a dash/hyphen where the feed should be after saving my page. Did I do something wrong when I installed the RSS Reader extension? Jim

I'm getting this error while trying my usual Recent Changes

 XML Parsing Error: XML or text declaration not at start of entity
 Location: https://mywikiname.com/index.php?title=Special:Recent_changes&feed=rss
 Line Number 2, Column 1:<?xml version="1.0" encoding="utf-8"?>
same error:
XML Parsing Error: XML or text declaration not at start of entity
Location: http://mywikiname.com/w/index.php?title=Special:RecentChanges&feed=atom
Line Number 2, Column 1:<?xml version="1.0"?>
^
It appears to be because of sloppy programming, extra whitespace.[1] I just used yahoo pipes and the extension:securehtml and will use that instead.
Okip 23:59, 9 June 2011 (UTC)Reply

No feed title[edit]

This works for me (in German)

https://wiki.example.com/wiki/index.php?title=Spezial:Letzte_%C3%84nderungen&feed=rss

But, if the Feed gets to much input (text), the title and the description of the feed aren't displayed on the Wiki's page. With only a few edits everything works fine.

Does someone has an idea how to solve this problem? I'm using version 1.14.1. --87.139.34.156 10:59, 28 January 2010 (UTC)Reply

How to get files attached to a rss posting?[edit]

Hi there, thanks for your great extension. i am importing some rss feeds with videos or soundfiles attached. if a video is attached, i want to integrate it directly into a page. but the extension does not seem to support this? Greets!--80.228.182.253 12:38, 16 March 2009 (UTC)Reply

Hello, I have same issue. I want to upload files into my MediaWiki (Wiki:1.14.0, PHP:5.2.8) attached by URL in RSS feeds.
How can I do this using your extension? Thanks --Kabanoff 11:52, 9 June 2009 (UTC)Reply

How to fix Parameter 3 to efCreateRSSReader() expected to be a reference[edit]

Warning: Parameter 3 to efCreateRSSReader() expected to be a reference, value given in
/home/site-user/site.domain/w/includes/parser/Parser.php on line 3333

In order to fix the error above, just edit $IP/extensions/RSSReader/RSSReader.php and replace

function efCreateRSSReader($input, $argv, &$parser){

with

function efCreateRSSReader($input, $argv, $parser){

This error happened to me when using this extension with MediaWiki 1.16.0 and PHP 5.3.5

--Elifarley 10:20, 26 February 2011 (UTC)Reply

Thanks for the post. I faced this error too. --Sgk001 17:31, 9 March 2011 (UTC)Reply

How to make cnet feed work[edit]

I am trying to use Extension:RSS -- Error: "http://news.cnet.com/2547-1_3-0-20.xml?tag=socialAboutLinks;stayConnected" is not in the list of allowed feeds. The allowed feeds are as follows: https://wikimediafoundation.org/news/feed/, https://wikimediafoundation.org/category/technology/feed/, https://wikimediafoundation.org/category/technology/mediawiki/feed/, https://discourse-mediawiki.wmflabs.org/c/ask-here.rss, https://codeclimate.com/github/wikimedia/mediawiki-extensions-CentralNotice/feed.atom, https://codeclimate.com/github/wikimedia/mediawiki-extensions-DonationInterface/feed.atom, https://codeclimate.com/github/wikimedia/wikimedia-fundraising-crm/feed.atom, https://codeclimate.com/github/wikimedia/wikimedia-fundraising-dash/feed.atom, https://codeclimate.com/github/wikimedia/wikimedia-fundraising-php-queue/feed.atom, https://codeclimate.com/github/wikimedia/wikimedia-fundraising-SmashPig/feed.atom and https://codeclimate.com/github/wikimedia/wikimedia-fundraising-tools/feed.atom. but nothing gets displayed except empty rows.

Also, Extension:RSS -- Error: "http://go.microsoft.com/fwlink/?linkid=84795&clcid=409" is not in the list of allowed feeds. The allowed feeds are as follows: https://wikimediafoundation.org/news/feed/, https://wikimediafoundation.org/category/technology/feed/, https://wikimediafoundation.org/category/technology/mediawiki/feed/, https://discourse-mediawiki.wmflabs.org/c/ask-here.rss, https://codeclimate.com/github/wikimedia/mediawiki-extensions-CentralNotice/feed.atom, https://codeclimate.com/github/wikimedia/mediawiki-extensions-DonationInterface/feed.atom, https://codeclimate.com/github/wikimedia/wikimedia-fundraising-crm/feed.atom, https://codeclimate.com/github/wikimedia/wikimedia-fundraising-dash/feed.atom, https://codeclimate.com/github/wikimedia/wikimedia-fundraising-php-queue/feed.atom, https://codeclimate.com/github/wikimedia/wikimedia-fundraising-SmashPig/feed.atom and https://codeclimate.com/github/wikimedia/wikimedia-fundraising-tools/feed.atom. throws errors.

Please can someone help?

Error - Undefined index lastBuildDate line 159[edit]

Anyone else getting this.

Notice Undefined index LastBuildDate in ..../w/extensions/RSSReader/lastRSS.php on line 159

Hutchy68 01:32, 17 January 2012 (UTC)Reply

_blank option for links[edit]

$wgExternalLinkTarget = '_blank';

is set in LocalSettings.php, however all links from RSSReader open in existing window. How do we set _blank as the option for links in the rss tags too?

Already mentioned

Display Image[edit]

Hi,

I am using this extension and currently I want to use Wikipedia Photo of the day rss feeds.

However, it is not displaying the images but instead it is displaying the image tag instead. <img alt= "" ... >

How do I get it to display images?

Thanks for all assistance!

How to add an rss feed in visual Editor?[edit]

I would like to add this type of feed using the visual editor. I tried to make a template the would include the right tags but it gives a cannot load feed error or shows as {{{1}}}. I thought that could be a workaround. Extension:RSS -- Error: "http://blog.wikimedia.org/feed/" is not in the list of allowed feeds. The allowed feeds are as follows: https://wikimediafoundation.org/news/feed/, https://wikimediafoundation.org/category/technology/feed/, https://wikimediafoundation.org/category/technology/mediawiki/feed/, https://discourse-mediawiki.wmflabs.org/c/ask-here.rss, https://codeclimate.com/github/wikimedia/mediawiki-extensions-CentralNotice/feed.atom, https://codeclimate.com/github/wikimedia/mediawiki-extensions-DonationInterface/feed.atom, https://codeclimate.com/github/wikimedia/wikimedia-fundraising-crm/feed.atom, https://codeclimate.com/github/wikimedia/wikimedia-fundraising-dash/feed.atom, https://codeclimate.com/github/wikimedia/wikimedia-fundraising-php-queue/feed.atom, https://codeclimate.com/github/wikimedia/wikimedia-fundraising-SmashPig/feed.atom and https://codeclimate.com/github/wikimedia/wikimedia-fundraising-tools/feed.atom.