By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,643 Members | 1,797 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,643 IT Pros & Developers. It's quick & easy.

Dynamic RSS

P: n/a
Jez
Does anyone have any experience of creating dynamic RSS feeds from a
database using PHP?

There's loads of information about RSS, but not much on RSS/PHP.

I'm sure it can't be too difficult, but I'm struggling to create a
file that's usable.

Thanks!

Jez
Jul 17 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
Jez:
Does anyone have any experience of creating dynamic RSS feeds from a
database using PHP?

There's loads of information about RSS, but not much on RSS/PHP.

I'm sure it can't be too difficult, but I'm struggling to create a
file that's usable.


I've never looked at RSS, but AFAIK it's just XML, so all you need to do is
generate XML, which is text, which means that

echo "<xml>$hello</xml>";

is about as complicated as it gets.

André Nęss
Jul 17 '05 #2

P: n/a
It never ceases to amaze me that people don't do a simple google search
for what they're looking for before posting a message in a newsgroup.

If you type "php rss feed class" into google, you're first entry will be:

http://cvs.geeklog.net/chora/co.php/...feed.class.php

"Jez" <je**********@btinternet.com> wrote in message
news:ad*************************@posting.google.co m...
Does anyone have any experience of creating dynamic RSS feeds from a
database using PHP?

There's loads of information about RSS, but not much on RSS/PHP.

I'm sure it can't be too difficult, but I'm struggling to create a
file that's usable.

Thanks!

Jez
Jul 17 '05 #3

P: n/a
>> Does anyone have any experience of creating dynamic RSS feeds from a
database using PHP?

There's loads of information about RSS, but not much on RSS/PHP.

I'm sure it can't be too difficult, but I'm struggling to create a
file that's usable.


I've never looked at RSS, but AFAIK it's just XML, so all you need to do is
generate XML, which is text, which means that


Don't know if this will help but there is an article about how to create an RSS
Feed at http://www.softwaremarketingresource.com/article18.html
Fred

Jul 17 '05 #4

P: n/a
furry (48.983% quality rating):

If you type "php rss feed class" into google, you're first entry will be:

cvs.geeklog.net/chora/co.php/geeklog-1.3/system/classes/rss.feed.class.php


ew.

Just do it directly, without objects, like God intended.

/joe
--
In the phatcave, Ryan Chaves types on the news server. Matt Magnasco fails
to impress City Cafe and looks for support from git.test and David Wada,
and then falls off the back of a UPS truck near Eric Adams? Bwooce likes to
chat with git.talk.phatjoe for a case and a smelly, gi-n... [tape runs out]
Jul 17 '05 #5

P: n/a
Jez
André Nęss <an*********************@ifi.uio.no> wrote in message news:<bo**********@maud.ifi.uio.no>...
Jez:
Does anyone have any experience of creating dynamic RSS feeds from a
database using PHP?

There's loads of information about RSS, but not much on RSS/PHP.

I'm sure it can't be too difficult, but I'm struggling to create a
file that's usable.


I've never looked at RSS, but AFAIK it's just XML, so all you need to do is
generate XML, which is text, which means that

echo "<xml>$hello</xml>";

is about as complicated as it gets.

André Nęss


My problem seems to be that a file with the .php extension won't
validate as RSS. An identical file with the .xml extension works
perfectly, but obviously that means I can't use php!

When looking through google (and I did do a fairly extensive search) I
found that people were using PHP to create an XML file on their server
via a cron job, but I can't understand why it's not possible to use
the php file as the feed because the output 'should' be valid xml ...
or perhaps not? Maybe it's something to do with headers?

I must be missing something here and any help would be gratefully
received!

Thanks!

Jez

PS. Afraid I haven't got my head round classes yet.
Jul 17 '05 #6

P: n/a
Jez
André Nęss <an*********************@ifi.uio.no> wrote in message news:<bo**********@maud.ifi.uio.no>...
Jez:
Does anyone have any experience of creating dynamic RSS feeds from a
database using PHP?

There's loads of information about RSS, but not much on RSS/PHP.

I'm sure it can't be too difficult, but I'm struggling to create a
file that's usable.


I've never looked at RSS, but AFAIK it's just XML, so all you need to do is
generate XML, which is text, which means that

echo "<xml>$hello</xml>";

is about as complicated as it gets.

André Nęss


Hmmmm, could be something to do with the fact that php doesn't like the ?>
in <?xml version="1.0" ?>

Maybe?
Jul 17 '05 #7

P: n/a
Raekwon, speaking through Jez, wrote:

Hmmmm, could be something to do with the fact that php doesn't like the ?>
in <?xml version="1.0" ?>


My very bare-bones RSS script (which is a .php file) starts like this:

<?php

include("common.php");

header("Content-Type: text/xml");

echo "<?xml version=\"1.0\"?>\n";
echo "<!-- RSS generation done by phat_joe -->\n";
echo "<rss version=\"0.91\">\n";
echo "\t<channel>\n";

It has no parsing problems, and I haven't had problems accessing it as
an RSS feed.

To the original poster, are you using the proper Content-Type?

/joe
--
The Scag is ordinary.
Jul 17 '05 #8

P: n/a
Hastur Batato, obviously a huge fan of John Linnell, wrote:

To the original poster, are you using the proper Content-Type?


Wait, I was replying to the original poster already :)

/joe
--
In the phatmobile, /home/pr0n is nauseous and priceless. Tim Faircloth
demolishes the fiber line. The memory is ghetto.
Jul 17 '05 #9

P: n/a
vKp
Jez wrote:
André Nęss <an*********************@ifi.uio.no> wrote in message news:<bo**********@maud.ifi.uio.no>...
Jez:

Does anyone have any experience of creating dynamic RSS feeds from a
database using PHP?

There's loads of information about RSS, but not much on RSS/PHP.

I'm sure it can't be too difficult, but I'm struggling to create a
file that's usable.


I've never looked at RSS, but AFAIK it's just XML, so all you need to do is
generate XML, which is text, which means that

echo "<xml>$hello</xml>";

is about as complicated as it gets.

André Nęss

Hmmmm, could be something to do with the fact that php doesn't like the ?>
in <?xml version="1.0" ?>

Maybe?


Yeah, escape that:

<?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"?".">"; ?>

Also, be sure to set the content-type to application/rss+xml

Jul 17 '05 #10

P: n/a
Hello,

On 11/06/2003 11:11 AM, Jez wrote:
Does anyone have any experience of creating dynamic RSS feeds from a
database using PHP?


You may want to try this class that does exactly what you need:

http://www.phpclasses.org/rsswriter

--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/

Jul 17 '05 #11

P: n/a
Jez
vKp <as*****@hotmail.com> wrote in message news:<bo*********@newsg1.svr.pol.co.uk>...
Jez wrote:
André Nęss <an*********************@ifi.uio.no> wrote in message news:<bo**********@maud.ifi.uio.no>...
Jez:
Does anyone have any experience of creating dynamic RSS feeds from a
database using PHP?

There's loads of information about RSS, but not much on RSS/PHP.

I'm sure it can't be too difficult, but I'm struggling to create a
file that's usable.

I've never looked at RSS, but AFAIK it's just XML, so all you need to do is
generate XML, which is text, which means that

echo "<xml>$hello</xml>";

is about as complicated as it gets.

André Nęss

Hmmmm, could be something to do with the fact that php doesn't like the ?>
in <?xml version="1.0" ?>

Maybe?


Yeah, escape that:

<?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"?".">"; ?>

Also, be sure to set the content-type to application/rss+xml


Nice one! Breaking up the ? and > has solved it!

Thanks everyone for your help.

Jez
Jul 17 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.