Link to my forum: https://sonomacountydsa.org/forums
SMF version: SMF ver. 2.0.18
TP version: TP ver. 2.0.1
Default Forum Language: English
Theme name and version: Default (Curve)
Browser Name and Version: Chrome, Firefox, Edge - All Current Versions
Mods installed: See attached image of package manager
Related Error messages: None
Hello and thank you for reading my post.
I recently moved over to Tiny Portal from Simple Portal. I brought 3 RSS feeds over and added them to the lower panel of my SMF 2.0.18 Forum with the latest version of TP (2.0.1) installed. Two of the feeds (both FoxNews feeds) display as expected, however the one for Police One displays nothing but an empty block. They all worked when I ws running on Simple Portal.
A search of other posts revealed nothing helpful or similar to this issue where the feed link is good but doesn't work on a Tiny Portal block but works on other sites, and other feeds work ok.
I have also tried moving the block to other parts of the panel to no avail. I even copied the link to another RSS feed block that works with a different feed and still nothing so I know the block settings aren't the issue.
I still have another site on the same hosting account using Simple Portal. The same Police One block on the Simple Portal RRS block still works fine on that site, which rules out a hosting issue.
The feed link I'm using is the one provided by the Police One website shown below:
https://www.police1.com/law-enforcement-police-rss-feeds/news.xml
I was wondering if someone could test the feed on their Tiny Portal site to see if it works for them and also if anyone can point me to a potential fix to for the feed on my site.
Is it possible this is an unknown bug?
Any help would be appreciated.
Happy Monday!
Mike V.
Hi Mike.
Not sure what's happening on your site, but that feed works fine for me in TP 2.0.1 as you can hopefully see here, http://lts4.byethost7.com/testsite5/index.php
Mick, I tried it too, and this feed does not work for me either (on 2.1.0)
I am getting these errors in the log:
../public_html/test2/Sources/TPSubs.php (Line 1789) Backtrace information
Type of error: General
Error messageSelect
2: simplexml_load_file(https://www.police1.com/law-enforcement-police-rss-feeds/news.xml): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden
and
../public_html/test2/Sources/TPSubs.php (Line 1789) Backtrace information
Type of error: General
Error messageSelect
2: simplexml_load_file(): I/O warning : failed to load external entity "https://www.police1.com/law-enforcement-police-rss-feeds/news.xml"
Try this in place of that function.
simplexml_load_string(file_get_contents($file));
It's a bug in php and entities so probably why lurkalot doesn't get it but you do @rjen
Quote from: tino on April 13, 2021, 09:02:33 AM
Try this in place of that function.
simplexml_load_string(file_get_contents($file));
It's a bug in php and entities so probably why lurkalot doesn't get it but you do @rjen
That takes care of the second error, but not the first. The RSS block is still empty and getting this error..
https://test.fjr-club.nl/index.php??
2: file_get_contents(https://www.police1.com/law-enforcement-police-rss-feeds/news.xml): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden
Bestand: /home/deb77453/domains/fjr-club.nl/public_html/test/Sources/TPSubs.php
Regel: 1789
Quote from: @rjen on April 13, 2021, 03:01:49 PM
Quote from: tino on April 13, 2021, 09:02:33 AM
Try this in place of that function.
simplexml_load_string(file_get_contents($file));
It's a bug in php and entities so probably why lurkalot doesn't get it but you do @rjen
That takes care of the second error, but not the first. The RSS block is still empty and getting this error..
https://test.fjr-club.nl/index.php??
2: file_get_contents(https://www.police1.com/law-enforcement-police-rss-feeds/news.xml): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden
Bestand: /home/deb77453/domains/fjr-club.nl/public_html/test/Sources/TPSubs.php
Regel: 1789
That's from the server you are querying. I'm guessing your region is banned from accessing it. Or something is different in the request to what lurkalot has. Either way that's on the remote server side not local.
If you try this in a php block does it work?
<?php
$opts = array(
'http'=>array(
'user_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13',
'method'=>"GET",
'header'=> implode("\r\n", array(
'Content-type: text/plain;',
)
)
)
);
$context = stream_context_create($opts);
$url = 'https://www.police1.com/law-enforcement-police-rss-feeds/news.xml';
$xml = file_get_contents($url, false, $context);
$xml = simplexml_load_string($xml);
var_dump($xml);
?>
I don't suggest you adopt that in TinyPortal mind, but it might allow the request through, by faking being a browser.
Well it does do something....
Quote from: @rjen on April 13, 2021, 06:28:59 PM
Well it does do something....
It just dumps the xml to screen, so the remote side must have security checks to make sure the user agent is valid.
Interesting would be to know what the remote side considers a 'valid agent'... and since the OP stated that his SimplePortal site did work...
:hmm:
Is TP not a valid agent?
:tickedoff:
I think it uses the get_url_data function in SMF to make the request. Could probably include the files and do it that way also, then use load_string on it.
$curl = new curl_fetch_web_data(array(CURLOPT_BINARYTRANSFER => 1));
$request = $curl->get_url_data($request);
$responseCode = $request->result('code');
$response = $request->result();
That's from the proxy.php file in SMF so an adaption of that would probably work, you don't need the return transfer. Checking response code isn't a bad idea.
I don't know if that's the same for SMF 2.0 mind as I can't see that source code online.
Thanks to all of you for the discussion on the issue I'm seeing. I'm sure others will be affected by it at some point. So resolving it would be great for everyone.
I am not a PHP programmer. I sure wish I had the knowledge you guys do. I hate bugging people for fixes like this and learning PHP would be helpful on multiple levels but my life is simply too hectic for it ATM.
That being said, thanks to your conversation here, I was able to do some searching and found the below post for a similar problem a Wordpress user experienced an they found a coding flaw related a failure to use the 'User-Agent' header with get requests for RSS feed queries. This appears to be similar code to the code example Tino just published in his previous post. Below is a link if one of you have a moment to take a look and see if it would help lead to a solution?
https://github.com/chaoss/grimoirelab-perceval/issues/128 (https://github.com/chaoss/grimoirelab-perceval/issues/128)
Thanks again!
Mike V.
To get it to work on ElkTinyPortal I did this;
Remove
$allow_url = ini_get('allow_url_fopen');
if ($allow_url){
$xml = simplexml_load_file($backend);
} else {
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_URL, $backend);
$ret = curl_exec($curl);
curl_close($curl);
$xml = simplexml_load_string($ret);
}
Add
require_once(SUBSDIR . '/Package.subs.php');
$data = fetch_web_data($backend);
$xml = simplexml_load_string($data);
require_once(SUBSDIR . '/Package.subs.php');
? that doesn't work in SMF... Sounds like something ELKspecial to me?
Just compared the code and for SMF this seems to work...
require_once($sourcedir . '/Subs-Package.php');
$data = fetch_web_data($backend);
$xml = simplexml_load_string($data);
tested this on 2.0.18 and on 2.1 RC4. Works on both: I'll add this to TP 2.1.0
I think it's in Subs.php but yes that's the equivalent.
https://github.com/SimpleMachines/SMF2.1/blob/77c87540ef6f879ca52088a7e781a46678132114/Sources/Subs.php#L5408
It is in Subs.php or at least it is on SMF2.1 so that should be required.
That's funny, tested with 2.1 and it worked on subs.packages.php too...
Quote from: @rjen on April 17, 2021, 08:26:22 PM
That's funny, tested with 2.1 and it worked on subs.packages.php too...
Probably as it's included already by something else. I think it's a core file anyway.
I want to thank everyone for their efforts on this. I certainly didn't expect it to require so much time from all of you. It's very much appreciated.
One question I have is why it works on the site Lurkalot tested it on but not others?
Quote
Not sure what's happening on your site, but that feed works fine for me in TP 2.0.1 as you can hopefully see here, http://lts4.byethost7.com/testsite5/index.php
The only difference with my site might be a plugin or the fact I'm running SMF version 2.0.18 and his test site is running 2.0.17. Are others with this issue using one of the same plugins I am?
Could it be something more obvious than a coding problem? Why it would work for him and not us is a mystery given he too uses the same version of Tiny Portal I do.
Thank again for everything,
Mike
It's to do with the headers being sent. It might be his Apache or Htttpd daemon is adding them or proxy in front adding them.
The fix resolves this problem on the TinyPortal side so that's the best option.
For the basic SMF / Tiny Portal users like me, could one of you post exactly what I need to do to make enact this change so the RSS feed issue works on my SMF 2.0.18 / Tiny Portal 2.0.1 forum? If someone could post something like:
In this file
Find this code or section
And add or replace this code with this code
This would really help basic users like me to incorporate the fix.
Also, is this something that related to Tiny Portal or SMF, and should I request it be changed somewhere for a future release or has that request already been made?
THANK YOU!
Mike Vail
The change is already made in TinyPortal 2.1.0
Not sure when it will be released though...
The code changes for the fix can be found here: https://github.com/Tinyportal/TinyPortal/commit/d72faac7c9afae6fbe01b7a1c3908fe377af1197
Thank you @rjen! I'm up and running with all RSS feeds working as expected! Thanks to all who contributed to this fix!
Mike
Good evening all,
I'm replying to the older thread because it appears the same problem I originally posted has returned. One of my RSS feeds is displaying only an empty block. Two others work fine.
The broken feed is:
https://www.police1.com/law-enforcement-police-rss-feeds/news.xml
Updated code provided previously in this thread had temporarily fixed the problem but that too has now stopped working. I wanted to post this notice so that the Dev team was aware it broke again in hopes that it could be fixed before the next TP release. If someone has time to look at it, I'd appreciate it.
I hope everyone is doing ok in these crazy times.
Warmest,
Mike Vail
Quote from: Mike Vail on September 27, 2021, 05:10:03 AM
Good evening all,
I'm replying to the older thread because it appears the same problem I originally posted has returned. One of my RSS feeds is displaying only an empty block. Two others work fine.
The broken feed is:
https://www.police1.com/law-enforcement-police-rss-feeds/news.xml
Updated code provided previously in this thread had temporarily fixed the problem but that too has now stopped working. I wanted to post this notice so that the Dev team was aware it broke again in hopes that it could be fixed before the next TP release. If someone has time to look at it, I'd appreciate it.
I hope everyone is doing ok in these crazy times.
Warmest,
Mike Vail
That rss feed works fine for me. Are you sure it's not being blocked by their side as you have tried to access it too many times?
I don't know why they would block my site. My site isn't busy enough to generate a level of traffic that would cause a feed to blocked. I even disabled the block for a few days and re-enabled it today. Still nothing. I don't get why it randomly just stopped working. I'm wondering is anyone would be willing to test the feed on their TP version 2.01 SMF 2.0.18 site?
Thank you,
Mike Vail
The only test site I have running TP 2.0.1 is on SMF 2.1 at the moment. That feed works fine on there, it's at the bottom. http://lts4.byethost7.com/testsite7/index.php
But saying thet, it always did work as you can see below, It's been running on there since we first tested it back in April. Though I have upgraded that site to TP 2.1.0
Quote from: lurkalot on April 13, 2021, 07:49:06 AM
Hi Mike.
Not sure what's happening on your site, but that feed works fine for me in TP 2.0.1 as you can hopefully see here, http://lts4.byethost7.com/testsite5/index.php
Quote from: Mike Vail on September 28, 2021, 01:46:31 AM
I don't know why they would block my site. My site isn't busy enough to generate a level of traffic that would cause a feed to blocked. I even disabled the block for a few days and re-enabled it today. Still nothing. I don't get why it randomly just stopped working. I'm wondering is anyone would be willing to test the feed on their TP version 2.01 SMF 2.0.18 site?
Thank you,
Mike Vail
TinyPortal 2.1.0 is the latest version now, which has the fix discussed in this thread in it. Available to download here https://www.tinyportal.net/index.php?action=tportal;sa=download;dl=item168
I have tested on that as it is the latest version we support and I don't have any issues, that was on SMF 2.0.18.
Thank you guys! I completely missed that TP 2.1.0 had been released. I installed it and BOOM! the feed works! THANK YOU SO MUCH FOR YOUR HELP AND ALL YOUR SUPPORT TO THIS COMMUNITY!
Have a great week,
Mike Vail
Quote from: Mike Vail on September 29, 2021, 06:14:16 AM
Thank you guys! I completely missed that TP 2.1.0 had been released. I installed it and BOOM! the feed works! THANK YOU SO MUCH FOR YOUR HELP AND ALL YOUR SUPPORT TO THIS COMMUNITY!
Have a great week,
Mike Vail
Glad that worked for you. O0