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? 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. 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? 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"); ?> 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>[email protected]</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 https://forums.phpfreaks.com/topic/73198-php-for-rss-feeds/#findComment-369252 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.