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 6786347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:14:04+00:00 2026-05-26T17:14:04+00:00

I want to read and save some data from this rss feed to in

  • 0

I want to read and save some data from this rss feed to in my database table. The
RSS feed is http://feeds.feedburner.com/TechCrunch/.

I have used the following code before to read another RSS feed:

$homepage = file_get_contents('http://rss.cnn.com/rss/edition_technology.rss');
$homepage = preg_replace("/(<\/?)(\w+):([^>]*>)/", "$1$2$3", $homepage);
$xml = simplexml_load_string($homepage,'SimpleXMLElement', LIBXML_NOCDATA);

echo '<pre>';
print_r($xml);

foreach($xml->channel->item as $opt) {
    $title = mysql_real_escape_string($opt->title);
    $link = mysql_real_escape_string($opt->link);
    $des = mysql_real_escape_string($opt->description);
    // and others
    $sql = 
        "INSERT INTO store_feed (title, link, description) 
         VALUES('$title','$link','$des') 
         ON DUPLICATE KEY UPDATE title = '$title', description = '$des'";
    $result = mysql_query($sql) or die( mysql_error() );
}

… and I got the desired data, but this time data is different.

I want to store link, description, image, publish date, title of this feed. How can I do this?

I know how to insert into a database but how do I get this data from the RSS feed? Please, I need guidance.

  • 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-26T17:14:04+00:00Added an answer on May 26, 2026 at 5:14 pm

    When you use simplexml_load_string() on an xml string, you convert it to an object tree.

    This XML:

    <channel>
      <item>
        <title>Example Title</title>
        <description>Example Description</description>
      </item>
    </channel>
    

    … is converted to something you can use like so:

    $xml->channel->item->title;
    $xml->channel->item->description;
    

    So you need to look at XML of the new RSS feed to see how you can change your code. It will probably look something like this:

    foreach($xml->channel->item as $opt) {
        $title = mysql_real_escape_string($opt->title);
        $link = mysql_real_escape_string($opt->link);
        $des = mysql_real_escape_string($opt->description);
        $publication_date = mysql_real_escape_string($opt->pubDate);
        $image = mysql_real_escape_string(strip_tags($opt->description, '<img>'));
    }
    

    The image is inside the description, so we can extract it using strip_tags().

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

Sidebar

Related Questions

I read some data from a table and after that I want to edit
I want to store some data from structures like this: class Project { ChildA
This is a classic c/p problem where some threads produce data while other read
I want to save a matrix to a text file, so I can read
I want to read all items of a feed in C#. The solutions I've
I want to read and write from serial using events/interrupts. Currently, I have it
I want to read line n1->n2 from file foo.c into the current buffer. I
I want to read UTF-8 input in Perl, no matter if it comes from
Because of legacy data which is not available in the database but some external
I have a image from files = request.FILES['new_photo'].read() and i want to know it's

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.