Announcement

Collapse
No announcement yet.

Rss feed

Collapse
X
Collapse
First Prev Next Last
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Rss feed

    I have a RSS news feed in my admin cp and you have to locate a forum you want the feed to go to.

    It creates a post in this forum lots of times a days and all i would like to do is have all these feeds go in one thread.

    Now they did use to have a plugin over at vbulletin.org but that's now shut and I cant even find it on vbulletin.com

    I even created my own plugin code below and guess what it dont work

    Any help on this would be great

    <?php
    if (!defined('VB_ENTRY')) die('Access denied.');

    // Define the feed URL and the target thread ID
    $rss_feed_url = 'https://www.gbnews.com/feeds/news.rss';
    $thread_id = 10;

    // Fetch the RSS feed with error handling
    $rss = @simplexml_load_file($rss_feed_url);
    if ($rss === false) {
    echo 'Error: Unable to fetch RSS feed. Please check the feed URL or network connection.';
    exit;
    }

    $post_content = '';
    foreach ($rss->channel->item as $item) {
    $title = (string)$item->title;
    $link = (string)$item->link;
    $description = (string)$item->description;
    $post_content .= "$title\n\n$link\n\n$description\n\n";
    }

    if (!empty(trim($post_content))) {
    global $vbulletin;

    $post_data = array(
    'threadid' => $thread_id,
    'userid' => 1,
    'username' => 'The one',
    'title' => 'RSS Feed Update',
    'pagetext' => $post_content,
    'dateline' => TIMENOW,
    'visible' => 1
    );

    // Sanitize user inputs
    $username_safe = $vbulletin->db->escape_string($post_data['username']);
    $title_safe = $vbulletin->db->escape_string($post_data['title']);
    $pagetext_safe = $vbulletin->db->escape_string($post_data['pagetext']);

    // Insert the post into the database
    $vbulletin->db->query_write("
    INSERT INTO " . TABLE_PREFIX . "post
    (threadid, userid, username, title, pagetext, dateline, visible)
    VALUES
    ({$post_data['threadid']}, {$post_data['userid']}, '$username_safe', '$title_safe', '$pagetext_safe', {$post_data['dateline']}, {$post_data['visible']})
    ");
    } else {
    echo 'Error: No valid content to post from RSS feed.';
    }
    ?>​

    #2
    The SQL query seems to be from vB4 or older. There is no "post" table in vB5 and vB6 which have node, text and closure tables for storing the posts.
    Buy me a coffeePayPal QR Code
    My Amazon Affiliate Link
    Fast vBulletin VPS Host:
    This site is hosted by IONOS

    Comment


      #3
      Originally posted by glennrocksvb View Post
      The SQL query seems to be from vB4 or older. There is no "post" table in vB5 and vB6 which have node, text and closure tables for storing the posts.
      I'm just hoping someone may have the plugin that works for vbulletin 4.2.1 there was a plugin for the rss on vbulletin.org but its now closed

      Comment


        #4
        so i would like this rss feed https://www.gbnews.com/feeds/news.rss to post all its feeds in this one thread https://forumstatus.jandeane81.com/s...10-latest-news

        Any help would be great

        Comment

        Latest Posts

        Collapse

        Working...
        X
        Searching...Please wait.
        An unexpected error was returned: 'Your submission could not be processed because you have logged in since the previous page was loaded.

        Please push the back button and reload the previous window.'
        An unexpected error was returned: 'Your submission could not be processed because the token has expired.

        Please push the back button and reload the previous window.'
        An internal error has occurred and the module cannot be displayed.
        There are no results that meet this criteria.
        Search Result for "|||"