adrianTNT Posted November 6, 2007 Share Posted November 6, 2007 Hello, I want to generate a feed file dynamically inside a .php file, but in my browser it looks like a plain file even if the source file contains the right tags, I simplified it to this code (attached), is the header info incorrect or why does the browser read it like a plain file? <?php header ("content-type: text/xml");?> <?php echo html_entity_decode('<?xml version="1.0" encoding="UTF-8" ?>');?> <rss VERSION="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <channel> <item> <title>Pong</title> <link>http://www.site.com/flash/games/pong_1327.html</link> <description>Flash Ping-Pong game.Just my version of one of the first games.</description> </item> <item> <title>RSS reader</title> <link>http://www.site.com/flash/web_applications_and_data/rss_reader_1326.html</link> <description>RSS reader in AS2, uses shared object to save the address if u want</description> </item> </channel> </rss> I can make it physically save an XML file but I prefer to show the xml contents in the php file. Any ideas? Thanks. Quote Link to comment Share on other sites More sharing options...
btherl Posted November 7, 2007 Share Posted November 7, 2007 Your code works fine for me. Did you add an empty line or space before sending the header? Quote Link to comment Share on other sites More sharing options...
HaLo2FrEeEk Posted November 7, 2007 Share Posted November 7, 2007 You want it to show the contents of the file, like a feed? I have experience with this as I created a generator that would create an xml feed from the contents of the news table in my database. Quote Link to comment Share on other sites More sharing options...
adrianTNT Posted November 7, 2007 Author Share Posted November 7, 2007 Your code works fine for me. Did you add an empty line or space before sending the header? It works now. No spaces when I tested but today it works fine, it was a cache issue. You want it to show the contents of the file, like a feed? I have experience with this as I created a generator that would create an xml feed from the contents of the news table in my database. Yes, something like that, but the problem now was the header info to tell browsers to treat it like an XML file, I will now see if it works to dinamically generate the tags, this part should not be a problem. Thank you both for your time. Quote Link to comment 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.