Jump to content

PHP for RSS feeds


sotusotusotu

Recommended Posts

Hey all,

 

I just wanted to ask if anybody knows if you can use php for RSS feeds.  For example, I would like to query a db and bring some user information into my RSS feed.  I have not been able to find any examples anywhere.  I need to see if it is possible for a RSS reader to be able to accept the files and only see the XML itself?

 

Can anyone point me in the right direction please?

Link to comment
Share on other sites

Sorry, looks like the link I gave you is for an rss parser anyway, but to answer your last question...Yes, you just need to make sure you send the right header.

 

<?php header("Content-Type: application/xml; charset=ISO-8859-1"); ?>

Link to comment
Share on other sites

Cheers mate. Looking back I didn't word the question very well.

 

I am doing a test at the moments (sorry this is all completely new to me) and using the following code:

 

<? header("Content-Type: application/xml; charset=ISO-8859-1"); ?>

<?

echo '

  <?xml version="1.0"?>

      <rss version="2.0">


      <channel>


      <title>Test</title>
      <link>bigstuff.mp3</link>
      <description>Podcast</description>
      <language>en-us</language>
      <copyright>2005</copyright>
      <lastBuildDate>Today’s Date*</lastBuildDate>
      <webMaster>info@site.com</webMaster>
      <ttl>1</ttl>
      <item>


      <title>Podcast</title>
      <description>Here is my Monday podcast. Hope you like it.</description>
      <pubDate>Sun, 14 Oct 2007 14:30:00 GMT</pubDate>*

<enclosure url="bigstuff.mp3" length="4834743" type="audio/mpeg"/>
</item>
</channel>
</rss>

';

?>

 

I am receiving the following error:

 

XML Parsing Error: xml declaration not at start of external entity
Location: http://www.stuffdevelopment.com/sc_subscribe/subscribe.php
Line Number 4, Column 4:	  <?xml version="1.0"?>
----------^

 

Any ideas? or am I going about this the wrong way.

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.