XML with PHP content

J

Jemdam.com

Hi,

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
</Files>

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?

Thanks,

David - http://www.pubtricks.com
 
T

Toby Inkster

Jemdam.com said:
AddHandler application/x-httpd-php .xml

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:

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

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

Make sure you include the following in your PHP:

<?php
header("Content-Type: text/xml");
?>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top