sotusotusotu Posted October 14, 2007 Share Posted October 14, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/73198-php-for-rss-feeds/ Share on other sites More sharing options...
trq Posted October 14, 2007 Share Posted October 14, 2007 I found heaps of examples/tutorials on google, here is one that seems pretty straight to the point. Quote Link to comment https://forums.phpfreaks.com/topic/73198-php-for-rss-feeds/#findComment-369235 Share on other sites More sharing options...
sotusotusotu Posted October 14, 2007 Author Share Posted October 14, 2007 I know that PHP can output the XML, but can readers accept PHP files? Quote Link to comment https://forums.phpfreaks.com/topic/73198-php-for-rss-feeds/#findComment-369238 Share on other sites More sharing options...
trq Posted October 14, 2007 Share Posted October 14, 2007 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"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/73198-php-for-rss-feeds/#findComment-369241 Share on other sites More sharing options...
sotusotusotu Posted October 14, 2007 Author Share Posted October 14, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/73198-php-for-rss-feeds/#findComment-369252 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.