Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 35559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:15:18+00:00 2026-05-10T14:15:18+00:00

I have a old website that generate its own RSS everytime a new post

  • 0

I have a old website that generate its own RSS everytime a new post is created. Everything worked when I was on a server with PHP 4 but now that the host change to PHP 5, I always have a ‘bad formed XML’. I was using xml_parser_create() and xml_parse(…) and fwrite(..) to save everything.

Here is the example when saving (I read before save to append old RSS line of course).

function SaveXml() {     if (!is_file($this->getFileName()))     {         //Création du fichier         $file_handler = fopen($this->getFileName(),'w');          fwrite($file_handler,'');          fclose($file_handler);     }//Fin du if      //Header xml version='1.0' encoding='utf-8'     $strFileData = '<?xml version='1.0' encoding='iso-8859-1' ?><rss version='2.0' xmlns:dc='http://purl.org/dc/elements/1.1/'><channel><title>'.$this->getProjectName().'</title><link>http://www.mywebsite.com</link><description>My description</description><lastBuildDate>' . date('r'). '</lastBuildDate>';      //Data     reset($this->arrData);     foreach($this->arrData as $i => $value)     {         $strFileData .= '<item>';             $strFileData .= '<title>'. $this->GetNews($i,0) . '</title>';             $strFileData .= '<pubDate>'. $this->GetNews($i,1) . '</pubDate>';             $strFileData .= '<dc:creator>'. $this->GetNews($i,2) . '</dc:creator>';             $strFileData .= '<description><![CDATA['. $this->GetNews($i,3) . ']]> </description>';             $strFileData .= '<link><![CDATA['. $this->GetNews($i,4) . ']]></link>';             $strFileData .= '<guid>'. $this->GetNews($i,4) . '</guid>';             //$strFileData .= '<category>'. $this->GetNews($i,5) . '</category>';             $strFileData .= '<category>Mycategory</category>';         $strFileData .= '</item>';      }//Fin du for i       $strFileData .= '</channel></rss>';        if (file_exists($this->getFileName()))//Détruit le fichier         unlink($this->getFileName());       $file_handler = fopen($this->getFileName(),'w');        fwrite($file_handler,$strFileData);      fclose($file_handler); }//Fin de SaveXml 

My question is : how do you create and fill up your RSS in PHP?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T14:15:18+00:00Added an answer on May 10, 2026 at 2:15 pm

    At swcombine.com we use Feedcreator. Use that one and your problem will be gone. 🙂

    Here is the PHP code to use it once installed:

    function feed_simnews() {     $objRSS = new UniversalFeedCreator();     $objRSS->title = 'My News';     $objRSS->link = 'http://link.to/news.php';     $objRSS->description = 'daily news from me';     $objRSS->xsl = 'http://link.to/feeds/feedxsl.xsl';     $objRSS->language = 'en';     $objRSS->copyright = 'Copyright: Mine!';     $objRSS->webmaster = 'webmaster@somewhere.com';     $objRSS->syndicationURL = 'http://link.to/news/simnews.php';     $objRSS->ttl = 180;      $objImage = new FeedImage();     $objImage->title = 'my logo';     $objImage->url = 'http://link.to/feeds/logo.jpg';     $objImage->link = 'http://link.to';     $objImage->description = 'Feed provided by link.to. Click to visit.';     $objImage->width = 120;     $objImage->height = 60;     $objRSS->image = $objImage;      //Function retrieving an array of your news from date start to last week     $colNews = getYourNews(array('start_date' => 'Last week'));      foreach($colNews as $p) {         $objItem = new FeedItem();         $objItem->title = $p->title;         $objItem->description = $p->body;         $objItem->link = $p->link;         $objItem->date = $p->date;         $objItem->author = $p->author;         $objItem->guid = $p->guid;          $objRSS->addItem($objItem);     }      $objRSS->saveFeed('RSS2.0', 'http://link.to/feeds/news.xml', false); }; 

    Quite KISS. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.