0
votes

I'm trying to create a dynamic news rss feed. I found out that you can't put php tags in an xml file and when I tried to create php file that used the header

header("Content-Type: application/rss+xml; charset=ISO-8859-1");

I got this error

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/myserver/httpdocs/client_area/baking/site/index.php:72) in /var/www/vhosts/myserver/httpdocs/client_area/baking/site/pages/rss.php on line 3

1
This is a PHP error which means that you have already started outputing data when your header call is performed. Try to put that call 'earlier' in the execution. - Julien Genestoux
Just read the error and try to resolve what it says. Also ask google before you post in forums or q/a sites. You'll save yourself a lot flaming. - Joshua
Thanks Jojo that link that you gave helped me - user3095193

1 Answers

0
votes

You cannot use a header when the output has already started in other words:

Headers only work when your browser is completely white and not a single character or html tag or any output happened.

Do it earlier in the script before output happens.