TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 25, 2024, 09:49:00 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,173
  • Total Topics: 21,219
  • Online today: 319
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online

Some RSS Feeds Working and Others Are Not. TP - 2.0.1 - RSS Feed Bug?

Started by Michael Vail, April 13, 2021, 01:04:52 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tino

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.

Michael Vail

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

Thanks again!
Mike V.

tino

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);

@rjen

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
Running Latest TP on SMF2.1 at: www.fjr-club.nl

tino



@rjen

That's funny, tested with 2.1 and it worked on subs.packages.php too...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

tino

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.

Michael Vail

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

tino

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.