Welcome, Guest
Username: Password: Remember me
This is the optional forum header for the Suggestion Box.

TOPIC: RSS Feed from Forums Broken

Re: RSS Feed from Forums Broken 1 year 11 months ago #6004

  • Staze
  • Staze's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 61
  • Thank you received: 10
  • Karma: 7
Mac Mail RSS reader works too, and all the links for read more work. Interesting...

So Google reader is just being wonky with the validation issues.

It LOOKS like the RSS feed should be feeding "escaped" ampersands: stackoverflow.com/questions/1030102/why-...handle-the-ampersand rather than &. Which makes sense, but I'm not sure it was ever allowed. Which would make sense why Reader is removing them, since they're not allowed. No idea why Outlook and Mail simply allow them. Guessing to appease noisy RSS feeds.

www.therssweblog.com/?guid=20070522124846

Which makes me think... I'm going to run a quick test. Give me a few...
-Systems Administrator
"You mean you'll put down your rock and I'll put down my sword and we'll try to kill each other like civilized people?"

WEPS Pro-Pack I
Last Edit: 1 year 11 months ago by Staze.
The administrator has disabled public write access.
The following user(s) said Thank You: leomitch

Re: RSS Feed from Forums Broken 1 year 11 months ago #6007

  • Staze
  • Staze's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 61
  • Thank you received: 10
  • Karma: 7
You must be working on it at the same time, because now I'm getting weird results.

I was attempting to read in the RSS line by line, then replace any instances of & in a link or guid, with an &, but it appears some URLS now have & and some don't.

So, will let you continue working. Let me know if you need additional input/testing. Thanks!
-Systems Administrator
"You mean you'll put down your rock and I'll put down my sword and we'll try to kill each other like civilized people?"

WEPS Pro-Pack I
The administrator has disabled public write access.

Re: RSS Feed from Forums Broken 1 year 11 months ago #6008

  • wickededge
  • wickededge's Avatar
  • OFFLINE
  • Administrator
  • Posts: 1793
  • Thank you received: 648
  • Karma: 92
It's not me, but it might be the webmaster working at it too. I'll check with him and see what he has to say.
Staze wrote:
You must be working on it at the same time, because now I'm getting weird results.

I was attempting to read in the RSS line by line, then replace any instances of & in a link or guid, with an &, but it appears some URLS now have & and some don't.

So, will let you continue working. Let me know if you need additional input/testing. Thanks!
--Clay Allison
The administrator has disabled public write access.

Re: RSS Feed from Forums Broken 1 year 11 months ago #6013

  • Staze
  • Staze's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 61
  • Thank you received: 10
  • Karma: 7
Okay, here's what I've got at this point:

www.staze.org/static/fixwerss.php

This allows google reader to work...

All I'm doing is reading in the RSS line by line, and looking for any line that has <link> in it, and then replacing any & with &
foreach($feed_array as $line) {
	if(preg_match("<link>",$line)) {
		$fixed = preg_replace("/&/", "&amp;", $line);
	} elseif (preg_match("<title>",$line)) {
		$fixed = preg_replace("/&amp;/", "&", $line);
	} else {
		$fixed = $line;
	} 
	echo $fixed;
}

I was also trying to fix the & in the <title> field, but it doesn't seem to be working, but on the positive side, that doesn't seem to be breaking google reader.

Whole code is here:
<?php
header('Content-Type: text/xml; charset=UTF-8');
function get_url_contents($url) {
        //echo $url;
        $crl = curl_init();
        $timeout = 5;
        curl_setopt ($crl, CURLOPT_URL, $url);
        curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
        //curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
        curl_setopt ($crl, CURLOPT_HEADER, 0);
        curl_setopt ($crl, CURLOPT_USERAGENT, "Mozilla/4.0");
        $ret = curl_exec($crl);
        curl_close($crl);
        return $ret;
}

$url = 'http://www.wickededgeusa.com/index.php?option=com_kunena&func=rss&Itemid=63';
$feed = get_url_contents($url);
$feed_array = explode("\r", $feed);
//print_r($feed);
foreach($feed_array as $line) {
	if(preg_match("<link>",$line)) {
		$fixed = preg_replace("/&/", "&amp;", $line);
	} elseif (preg_match("<title>",$line)) {
		$fixed = preg_replace("/&amp;/", "&", $line);
	} else {
		$fixed = $line;
	} 
	echo $fixed;
}


?>
-Systems Administrator
"You mean you'll put down your rock and I'll put down my sword and we'll try to kill each other like civilized people?"

WEPS Pro-Pack I
Last Edit: 1 year 11 months ago by Staze.
The administrator has disabled public write access.

Re: RSS Feed from Forums Broken 1 year 11 months ago #6014

  • Staze
  • Staze's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 61
  • Thank you received: 10
  • Karma: 7
btw, realize the code is less than stellar. This is largely reused from fixing issues with Facebook's broken RSS feeds...
-Systems Administrator
"You mean you'll put down your rock and I'll put down my sword and we'll try to kill each other like civilized people?"

WEPS Pro-Pack I
The administrator has disabled public write access.
The following user(s) said Thank You: wickededge

Re: RSS Feed from Forums Broken 1 year 11 months ago #6019

  • Staze
  • Staze's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 61
  • Thank you received: 10
  • Karma: 7
okay, it isn't perfectly validating (there's currently no guid's), but here ya go:

Validator
RSS Fixer
<?php
header('Content-Type: text/xml; charset=UTF-8');
function get_url_contents($url) {
        //echo $url;
        $crl = curl_init();
        $timeout = 5;
        curl_setopt ($crl, CURLOPT_URL, $url);
        curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
        //curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
        curl_setopt ($crl, CURLOPT_HEADER, 0);
        curl_setopt ($crl, CURLOPT_USERAGENT, "Mozilla/4.0");
        $ret = curl_exec($crl);
        curl_close($crl);
        return $ret;
}

$url = 'http://www.wickededgeusa.com/index.php?option=com_kunena&func=rss&Itemid=63';
$feed = get_url_contents($url);
//$feed_array = explode("\r", $feed);
$feed_array = preg_split('/\n|\r/', $feed, -1, PREG_SPLIT_NO_EMPTY);
foreach($feed_array as $line) {
	if(preg_match("<link>",$line)) {
		$fixed = preg_replace("/&/", "&amp;", $line);
		$root_link_parts = preg_split('/>|</', $fixed, -1);
		$root_link = $root_link_parts[2];
		//$fixed = $fixed . "\n" . '<guid>' . $root_link . '</guid>';
	} elseif(preg_match("/<title>/",$line) == 1) {
		$fixed = preg_replace("/&amp;/", "", $line);
	} elseif(preg_match("/<guid>/",$line) == 1) {
		$fixed = '';
	} elseif(preg_match('/<channel>/', $line)) {
		$fixed = $line . "\n" . '<atom:link href="http://www.staze.org/static/fixwerss.php" rel="self" type="application/rss+xml" />';		
	} else {
		$fixed = $line;
	} 
	echo $fixed . "\n";
}

?>
-Systems Administrator
"You mean you'll put down your rock and I'll put down my sword and we'll try to kill each other like civilized people?"

WEPS Pro-Pack I
The administrator has disabled public write access.

Re: RSS Feed from Forums Broken 1 year 11 months ago #6020

  • Staze
  • Staze's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 61
  • Thank you received: 10
  • Karma: 7
Got GUID's working.

Now the only error is the image "link". But that's really nothing, other than just being nit picky.
-Systems Administrator
"You mean you'll put down your rock and I'll put down my sword and we'll try to kill each other like civilized people?"

WEPS Pro-Pack I
The administrator has disabled public write access.
The following user(s) said Thank You: wickededge

Re: RSS Feed from Forums Broken 1 year 11 months ago #6021

  • wickededge
  • wickededge's Avatar
  • OFFLINE
  • Administrator
  • Posts: 1793
  • Thank you received: 648
  • Karma: 92
Thanks Staze for bringing this up and all your help in getting it resolved!
Staze wrote:
Got GUID's working.

Now the only error is the image "link". But that's really nothing, other than just being nit picky.
--Clay Allison
The administrator has disabled public write access.

Re: RSS Feed from Forums Broken 1 year 11 months ago #6022

  • Staze
  • Staze's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 61
  • Thank you received: 10
  • Karma: 7
no prob. It'd been bugging me for a bit, but I figured I'd finally report it. =P

Until now I hadn't done the legwork to actually figure out what was going on, just that the links didn't work.
-Systems Administrator
"You mean you'll put down your rock and I'll put down my sword and we'll try to kill each other like civilized people?"

WEPS Pro-Pack I
The administrator has disabled public write access.

Re: RSS Feed from Forums Broken 1 year 11 months ago #6026

  • Staze
  • Staze's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 61
  • Thank you received: 10
  • Karma: 7
Obviously the issue should be fixed via patching Kunena, but my code should fix a general idea of the issue. The biggest one, is not HTML encoding the url's under <link>. Once that's addressed, I'm guessing the RSS will validate, albeit messily.

If I have time tomorrow I'll look at the code for 1.6 and see if I can figure out where it's going wrong.

And Clay, this is the least I can do given the product. =)
-Systems Administrator
"You mean you'll put down your rock and I'll put down my sword and we'll try to kill each other like civilized people?"

WEPS Pro-Pack I
The administrator has disabled public write access.
The following user(s) said Thank You: wickededge
Time to create page: 0.146 seconds