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 Responses to “Can PHP be used in RSS XML files? (E.g. a varible as the description?”

  • Jake Cigar:

    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

  • howsureyouare:

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

  • clievers:

    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>";
    ?>

Leave a Reply