Welcome, guest! Login
Close

Login to Your Account


  |  » Forgot your password?
Join

Notices

Thread: convert csv to rss feed?

 
Tools Search
  #1  
Old April 8th, 2008, 07:00 PM
Believe
Join Date: August 14th, 2006
Location: Dayton, Ohio
Posts: 1,815
convert csv to rss feed?

I'm looking for a program / script to convert some csv files into an rss feed. Did a google search and found several that convert to xml or convert rss into csv, but not what I'm needing.

ideas?
__________________
Someday starts today
Military Discounts
  #2  
Old April 9th, 2008, 04:34 AM
Full Member
Join Date: October 22nd, 2006
Posts: 200
No but I've got one that creates an RSS file from a mysql database.

With bit of tweaking you should be able to get it working with csv.

style="margin:20px; margin-top:5px">
PHP Code:
<?php
$link 
mysql_connect("localhost""user""pass")
   or die(
"Could not connect : " mysql_error());
  
mysql_select_db("database") or die("Could not select database");
$xml='<?xml version="1.0" encoding="utf-8"?>'."\r\n";
$xml.='<rss version="2.0">'."\r\n";
$xml.='<channel>'."\r\n";
$xml.='<title>Your title</title>'."\r\n";
$xml.='<link>http://www.yourwebsite.com</link>'."\r\n";
$xml.='<description>feed description.</description>'."\r\n";
$xml.='<language>en-US</language>'."\r\n";
$xml.='<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>'."\r\n";
$xml.='<lastBuildDate>Tue, 10 Jun 2003 09:41:01 GMT</lastBuildDate>'."\r\n";
$xml.='<docs>http://blogs.law.harvard.edu/tech/rss</docs>'."\r\n";
$xml.='<managingEditor>editor@example.com</managingEditor>'."\r\n";
$xml.='<webMaster>webmaster@example.com</webMaster>'."\r\n";
$sql ="SELECT * FROM flash ORDER by plays DESC LIMIT 10";
$result=mysql_query($sql);
while (
$line=mysql_fetch_assoc($result)){
$xml.='<item>'."\r\n";
$xml.='<title>'."\r\n";
$xml.=$line['name'];
$xml.='</title>'."\r\n";
$xml.='<description><![CDATA['."\r\n";
$xml.=$line['short_description'];
$xml.=']]></description>'."\r\n";
$xml.='<enclosure url="'.$line['image_url'].'" type="image/jpeg" />';
$xml.='<link>'.$line['product_url']'."</link>'."\r\n";
$xml.='</item>'."\r\n";
}
$xml.='</channel>'."\r\n";
$xml.='</rss>'."\r\n";
header("Content-type: application/xml");    
header('Content-Disposition:  filename="filename.xml"');
echo 
$xml;
?>
You just need to use $fp=fopen("file.csv")
Change the while loop to while ($data=fgetcsv($fp,8192,",")){
and use $data[0], $data[1] etc in place of $line['name'] etc
and finally fclose($fp);

The enclosure tag is optional and is only used by a few rss readers.
  #3  
Old April 9th, 2008, 01:03 PM
Affiliate Manager
Join Date: January 18th, 2005
Location: Los Angeles, California
Posts: 1,907
Do you want to do the whole feed, or select specific records from it?
__________________
Richard Gaskin
Developer of WebMerge: Publish any data feed on any site
http://www.fourthworld.com
Join ABW to remove this sponsored message.
  #4  
Old April 10th, 2008, 08:34 PM
Believe
Join Date: August 14th, 2006
Location: Dayton, Ohio
Posts: 1,815
style="margin:20px; margin-top:5px; ">
Quote:
Originally Posted by FourthWorld
Do you want to do the whole feed, or select specific records from it?
Richard,
At this point I'm trying to convert an entire csv file. I can see where it might be nice to create the feed based on a keyword(s). But this isn't a datafeed of products, it's actually geographic content for a site.
__________________
Someday starts today
Military Discounts
  #5  
Old April 11th, 2008, 01:09 AM
Affiliate Manager
Join Date: January 18th, 2005
Location: Los Angeles, California
Posts: 1,907
When do you need it?
__________________
Richard Gaskin
Developer of WebMerge: Publish any data feed on any site
http://www.fourthworld.com
Reply
 

Tools Search
Search:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Free Data Feeds and Free RSS Feeds jonlevine Commission Junction - CJ 9 May 15th, 2009 10:34 AM
RSS Feed Advice Matt McWilliams Marketing Resources & Power Tools 4 January 14th, 2007 04:51 PM
Combining Affiliate Programs with RSS mika Midnight Cafe' 1 May 31st, 2004 03:56 PM

X

Welcome to ABestWeb.com

Create your username to jump into the discussion!

ABestWeb.com is the largest affiliate marketing community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?



Content Relevant URLs by vBSEO ©2011, Crawlability, Inc.