• [deleted]

katos with a bit of modification, yes. You could create an associate array that defines the tag for each feed. I've been thinking about doing this myself as my forum evolves, so yes, it's certainly possible

    [deleted] Great! Thanks for this. Will have to dig into this and work out how I'm going to sort that.

    For now, I am currently getting a CSRF token mismatch error which I am trying to track down. Probably missed something silly to be fair.

    Hi [deleted],

    I have everything working with the feed DB, but nothing is posted to flarum.

    When I run php rssparser.php For each, out of the 10 items I get;
    This does not exist...processing Checking https://articleURL/ This does not exist...processing

    When I run php rssparser.php again For each, out of the 10 items I get;
    Checking https://articleURL/ This has already been processed...skipping

    When I check the feed DB, the id | url | title | seen content are there correctly.

    But, nothing is posted to flarum.

    Instructions I followed

    1. $header = array(
      "Authorization: Token the token you generated in the first step",
      "Content-Type: application/json"
      );

      I changed "Authorization: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",

    2. In my flarum_api_keys table I have;
      key = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      id = 1
      allowed_ips = NULL
      scopes = NULL
      user_id = I used "NULL" and I used the "userID"
      created_at = 0000-00-00 00:00:00
      last_activity_at = NULL

    3. array(
      'type' => 'tags',
      'id' => "23"
      )
      ` I changed 23 to the primary tag, (and even checked to make sure my tag settings is; Required Number of Primary Tags =1, Required Number of Secondary Tags =0)

    4. curl_setopt($ch, CURLOPT_POST, 22); - I changed 22 to the user ID and gave the user admin rights.

    Please what am I missing @[deleted] . Thanks in advance...

      • [deleted]

      Operator Did you install the flarum api client at the top of the guide, and create a key in the database ?

        [deleted]
        Yes,
        I installed
        composer require flagrow/flarum-api-client and composer require simplepie/simplepie
        Yes,
        I created a 40 character alphanumeric token

        • [deleted]

        Is CURL installed on your system ?

        Also, are you sure that the tag ID is correct ? The API is verbose, so should post some output as to why it didn't work. Can you set $items = 10; to $items = 1; then empty the feed table (truncate, not drop).

        Run rssparser.phpagain and post the output

        Thank you for replying...

        Yes CURL is installed.
        When I applied your instructions, I got
        Connected to database Processing RSS feed https://articleURL/ This does not exist...processing
        Checking the feed DB, the id | url | title | seen are there
        But, again nothing in flarum

        • [deleted]

        I know this sounds stupid (and it's my fault for not getting it right in the documentation) but within rssparser.php, can you ensure that you are referencing "details.php" using the correct path, and not as below ?

        include("/var/www/vhosts/phenomlab.com/details.php");

        It should be

        include("/path/to/your/details.php");

        Failing that, I will need some form of access to your environment to review this.

          [deleted]
          Obviously, Yes. That's why I get the Connected to database response because it comes from include("/path/to/my/details.php");

          Thank you, for your efforts... I would keep troubleshooting on my end.

            • [deleted]

            Operator Did you set this ?

            curl_setopt($ch, CURLOPT_URL, 'https://yourflarumurl/api/discussions');

              [deleted] Yes I when used curl_setopt($ch, CURLOPT_URL, 'https://yourflarumurl/api/discussions'); I got a csrf_token_mismatch 400 error
              Connected to database Processing RSS feed https://articleURL/ This does not exist...processing {"errors":[{"status":"400","code":"csrf_token_mismatch"}]}

              So, i changed it to curl_setopt($ch, CURLOPT_URL, 'api/discussions'); since I am running the script from root which clears the csrf_token_mismatch 400 error

              But, could my alteration have been the reason why flarum api is'nt taking in the request.?

                • [deleted]

                • Edited

                Operator

                But, could my alteration have been the reason why flarum api is'nt taking in the request.?

                Yes 🙂

                You need the full URL for the API to work - can you set that and try again ? For example https://www.myforum.com/api/discussions

                Okay, Changed it. But, now i am stuck with this error;
                Connected to database Processing RSS feed https://articleURL/ This does not exist...processing {"errors":[{"status":"400","code":"csrf_token_mismatch"}]}

                  • [deleted]

                  Operator Are you running Beta13 ? That bug was resolved in this release.

                    • [deleted]

                    Operator Hmmm... Any caching taking place, for example, NGINX etc ?

                    • [deleted]

                    Operator Let's take this offline to Discord. You can easily find me there 🙂 I have some questions which require answers but obviously not for posting here for security reasons.