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

  • SEARCH
  • Home
  • 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 6021897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:46:48+00:00 2026-05-23T03:46:48+00:00

I have an RSS data XML file existing on the folder. I have to

  • 0

I have an RSS data XML file existing on the folder. I have to append new data to the RSS XML file. I need to do it with PHP only. I have rss data (item, title, url, desc) coming from web service. I have to append to the existing rss xml file which has previous data.

RSS data format is like this

 <rss version="2.0">
  <channel>
    <title>My Site Feed</title>
    <link>http://www.mysitethathasfeed.com/feed/</link>
    <description>
        A nice site that features a feed.
    </description>
    <item>
        <title>Launched!</title>
        <link>http://www.mysitethathasfeed.com/feed/view.php?ID=launched</link>
        <description>
           We just launched the site! Come join the celebration!
        </description>
    </item>
  </channel>
</rss>

I want to add another item dynamically a using PHP only. How can I do that?

  • 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. Editorial Team
    Editorial Team
    2026-05-23T03:46:49+00:00Added an answer on May 23, 2026 at 3:46 am

    Have a look at: Document Object Model

    And here is something, which might get you started:

    $dom = new DOMDocument;
    $dom->load('%path-to-your-rss-file%');
    
    $xpath = new DOMXPath($dom);
    $channelNode = $xpath->query('/rss/channel')->item(0);
    if ($channelNode instanceof DOMNode) {
        // create example item node (this could be in a loop or something)
        $item = $channelNode->appendChild($dom->createElement('item'));
    
        // the title
        $item->appendChild(
            $dom->createElement('titel', '%title text%')
        );
        
        // the link
        $item->appendChild(
            $dom->createElement('link', '%link text%')
        );
        
        // the description
        $item->appendChild(
            $dom->createElement('description', '%description text%')
        );
    }
    
    $dom->save('%path-to-your-rss-file%');
    

    You’ll need write-access to the xml file, of course!

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

Sidebar

Related Questions

I have the following xml file in my res/raw folder - Title of RSS
I have an rss XML file: <?xml version=1.0 encoding=UTF-8?> <rss version=2.0> <channel> <title>ABC News</title>
I have an example XML like this: <rss version=2.0> <channel> <title></title> <link></link> <description></description> <item>
I have this PHP: <?php $data = file_get_contents('http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/football/rss.xml'); $xml = simplexml_load_string($data); $data1 = file_get_contents('http://www.skysports.com/rss/0,20514,11661,00.xml');
I have this code in PHP: <?php $data = file_get_contents('http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/football/rss.xml'); $xml = simplexml_load_string($data); echo
I'm using php to process rss data, however often feeds have more than image
very simple question, i have this: (only a part of the complete rss file)
I have a WordPress xml data file encoding with utf-8. But the WordPress impoter
I have an XML file that I need to sort. Worked great until the
I have WCF rest service returning XML/RSS feeds. Some methods return data contracts, some

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.