Skip to content

Can PHP be used in RSS XML files? (E.g. a varible as the description?

Can php be used in a xml file for displaying RSS feeds?
For example:
$variable = "Description text"
<description><php? echo $variable ?></description>
Would this work? using a varible to display the text on the feeds?
If not is there another way to use it?

3 Comments

  1. Jake Cigar wrote:

    a million ways to do it… look for an already written module to use… headers for the http, silly little rss version differences… they can drive ya crazy

    Tuesday, March 9, 2010 at 5:23 pm | Permalink
  2. howsureyouare wrote:

    you should use rss in php file and send it as application/rss+xml

    Tuesday, March 9, 2010 at 5:23 pm | Permalink
  3. clievers wrote:

    Yes, you could create a .php file that does whatever you need it to do, but output its content as xml.

    <?php
    header("Pragma: no-cache");
    header("Content-Type: text/xml");
    echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";

    /* Do your PHP stuff */

    echo "<node>";
    echo "</node>";
    ?>

    Tuesday, March 9, 2010 at 5:23 pm | Permalink

Post a Comment

Your email is never published nor shared.