0

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

Julien Genestoux
  • 31,046
  • 20
  • 66
  • 93
user3095193
  • 317
  • 2
  • 6
  • 17
  • 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 Jan 28 '14 at 08:50
  • Look at this post: http://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php/8028987#8028987 – Jojo Jan 28 '14 at 08:50
  • 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 Jan 28 '14 at 08:59
  • Thanks Jojo that link that you gave helped me – user3095193 Jan 28 '14 at 09:05

1 Answers1

0

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.

Steini
  • 2,753
  • 15
  • 24