XML with PHP content

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I want to make my XML feed dynamic. For example

test.xml?info=hello as a link and the feed to include the word hello when
echoed in a PHP statement $info.

I have changed the .htaccess file with the following:

AddHandler application/x-httpd-php .xml
<Files test>
ForceType application/x-httpd-php

I doesn't seem to work and I don't want to change the core files on the
server. Has anyone done this before or does anyone have some ideas?


David - http://www.pubtricks.com

Re: XML with PHP content

Jemdam.com wrote:

Quoted text here. Click to load it

This won't work -- "application/x-httpd-php" is not a handler, it's a MIME
type. The correct syntax is like:

    AddHandler php-script .xml

with a corresponding "Action" directive, something like this:

    Action php-script /cgi-bin/php

Where /cgi-bin/php is the path to your PHP interpreter.

Alternatively, if mod_php is installed (it usually is), then you can use

    AddType application/x-httpd-php .xml

Quoted text here. Click to load it

This doesn't work because there is no such file as "test". It's called

Make sure you include the following in your PHP:

    header("Content-Type: text/xml");

Toby A Inkster BSc (Hons) ARCS
Contact Me  ~ http://tobyinkster.co.uk/contact

Site Timeline