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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:51:46+00:00 2026-05-27T19:51:46+00:00

I’m working on converting an RSS feed from an old shopping cart to a

  • 0

I’m working on converting an RSS feed from an old shopping cart to a new one. The new cart will take CSV as an input. I think normally, I could tinker around with it and maybe figure it out – but there are some additional tasks that need completed with the feed before it gets put into CSV.

First, here is the raw feed http://www.bellyscarf.com/rsscategoryproducts.sc?categoryId=6

I don’t actually need too much data from the RSS, but here is what I do need (from each , these are my ‘fields’):

  • title
  • description*
  • price
  • sale price

*The description is where I need some work done. It has a bunch of html special characters, and html that I would like to remove (including any image references). Plain text is what I am looking for, in simpler terms.

Typically, are the fields added after generating the CSV file? I don’t mind adding them afterwards. I will be working with the CSV in Excel before it goes live anyways, adding additional fields and info.

Here is some code I wrote to parse the XML/RSS:

$ch = curl_init('http://bellyscarf.com/rsscategoryproducts.sc?categoryId=6');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
$data = curl_exec($ch);
curl_close($ch);

$doc = new SimpleXmlElement($data, LIBXML_NOCDATA);

if(isset($doc->channel))
{
    parseRSS($doc);
} else {
    echo "Not RSS";
}

function parseRSS($xml)
{
    echo "<strong>".$xml->channel->title."</strong>";
    $cnt = count($xml->channel->item);
    for($i=0; $i<$cnt; $i++)
    {
        $url = $xml->channel->item[$i]->link;
        $title = $xml->channel->item[$i]->title;
        $desc = html_entity_decode($xml->channel->item[$i]->description);

        echo '<a href="'.$url.'">'.$title.'</a>'.$desc.'';
    }
}

You can see its results here (not sure if it helps anything):
http://bestsox.com/zumba.php

So how can I generate a CSV file with this data?

  • 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-27T19:51:46+00:00Added an answer on May 27, 2026 at 7:51 pm

    Alex already showed how you can make use of fputcsv to create the CSV file, but you still have problems reading from the feed.

    First of all, you can more directly iterate over the channel items, so it’s easier to write your script:

    $doc = new SimpleXmlElement($data, LIBXML_NOCDATA);
    
    foreach($doc->channel->item as $item)
    {
        $link = $item->link;
        $title = $item->title;
    }
    

    To get the price tag, you need to access a children of another namespace. The namespace is defined within the RSS file and you need to know the URI of it. For gd: this is:

    http://app.fastshoppingcart.com/rss/featuredProduct/1.0
    

    You can then access the price like in the following, extended example:

    $doc = new SimpleXmlElement($data, LIBXML_NOCDATA);
    
    foreach($doc->channel->item as $item)
    {
        $link = $item->link;
        $title = $item->title;
    
        $gd = $item->children('http://app.fastshoppingcart.com/rss/featuredProduct/1.0');
        $price = $gd->price;
    }
    

    Now you wrote you wanted to remove the tags from the description field. This is not really good code, but this does the job quickly:

    $description = strip_tags(html_entity_decode($item->description));
    $description = str_replace(array("\xA0", "\r", "\n", "\t", "\l", "\f"), ' ', $description);
    $description = preg_replace('/\s{2,}/', ' ', $description);
    

    It makes use of strip_tags to remove all tags and then whitespaces are normalized with str_replace and preg_replace.

    I hope this is helpful.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported
I need to clean up various Word 'smart' characters in user input, including but
I have a text area in my form which accepts all possible characters from

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.