Jump to content

PHP & RSS


Gaia

Recommended Posts

hi,

I want to be able to export some data from a mySQL table to a rss file ( .rss ). So basically i want to create a .rss file for syndication on other websites.

How can you do that via PHP? If anyone can get me started or point me to a resource/tutorial or a section in the PHP Manual that discusses this?

Thanks.
Link to comment
Share on other sites

[!--quoteo(post=352961:date=Mar 8 2006, 03:17 PM:name=Gaia)--][div class=\'quotetop\']QUOTE(Gaia @ Mar 8 2006, 03:17 PM) [snapback]352961[/snapback][/div][div class=\'quotemain\'][!--quotec--]
hi,

I want to be able to export some data from a mySQL table to a rss file ( .rss ). So basically i want to create a .rss file for syndication on other websites.

How can you do that via PHP? If anyone can get me started or point me to a resource/tutorial or a section in the PHP Manual that discusses this?

Thanks.
[/quote]

I created my own object to do this. You can use the code if you like, it's part of my [a href=\"http://www.sourceforge.net/projects/phptodo\" target=\"_blank\"]phpTodo[/a] project.
Link to comment
Share on other sites

Thanks, but i'd rather learn how to do it myself and create my own function/class. Do you remember any of the resources/tutorials you used that helped you create your object?

Thanks ^_^
Link to comment
Share on other sites

[!--quoteo(post=353251:date=Mar 9 2006, 09:22 AM:name=Gaia)--][div class=\'quotetop\']QUOTE(Gaia @ Mar 9 2006, 09:22 AM) [snapback]353251[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Thanks, but i'd rather learn how to do it myself and create my own function/class. Do you remember any of the resources/tutorials you used that helped you create your object?

Thanks ^_^
[/quote]

Sure.. I looked up the specs for RSS 0.90, 1.0, and 2.0. I used those to figure out what the structure looked like, and then built a class to output that data. Here are some links for RSS :

[a href=\"http://backend.userland.com/rss092\" target=\"_blank\"]RSS 0.92 Spec[/a]
[a href=\"http://blogs.law.harvard.edu/tech/rss\" target=\"_blank\"]RSS 2.0 Spec[/a]

[a href=\"http://web.resource.org/rss/1.0/\" target=\"_blank\"]RSS 1.0 Spec[/a]

[a href=\"http://atompub.org/2005/07/11/draft-ietf-atompub-format-10.html\" target=\"_blank\"]Atom 1.0 Spec[/a]

NOTE : RSS 1.0 is *NOT* compatible with 2.0 ... Read the history. 1.0 is basically an off-shoot from 0.90 and developed independently from 2.0. 2.0 was named such so as to not confuse people..
Link to comment
Share on other sites

gaia, keep in mind that when an RSS reader hits a page, they typically do not care of the actual extension name, they only care about the actual mime type of the file. if you have it reading as XML and you have your generated feed valid, you can simply have a .php file that creates it on the fly. for instance, here is one that i created for the student newspaper at the university i work at: [a href=\"http://www.bju.edu/collegian/rss/index.php\" target=\"_blank\"]http://www.bju.edu/collegian/rss/index.php[/a]. it very simply pulls the information and dynamically generates the feed every time the page loads.

the nice thing about doing it this way is that if you have someone accessing your feed for synication, every single time they make a request, it's live, so any corrections or changes are immediately represented. notice that it's actually a .php file that's making the call, yet it renders as a validated RDF file.

hope this helps get you going in the right direction.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.