CodeIgniter Forums
Setting Content type in header - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Setting Content type in header (/showthread.php?tid=1978)



Setting Content type in header - El Forum - 07-09-2007

[eluser]pmonty[/eluser]
I am using this in my code:
Code:
$this->output->set_header("Content-type: text/xml");
//do some stuff and then
echo $xmlstream;

But gettng this in my headers (using an http analyzer to capture the http stream):
Code:
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Mon, 09 Jul 2007 19:56:53 GMT
Connection: close
X-Powered-By: PHP/5.2.3
Content-type: text/html

Am I using the wrong syntax or something in my set_header command that anyone can see?

Paul


Setting Content type in header - El Forum - 07-09-2007

[eluser]batteries[/eluser]
make sure nothing is output before header. Just some ideas.. but have you tried capitalizing the 't' in 'type'? (i'm not sure if that even matters) have you tried header('Content-Type: text/xml'); ?


Setting Content type in header - El Forum - 07-09-2007

[eluser]pmonty[/eluser]
Batteries,

Tried both capitalizing the T in Type and enclosing in single quotes...no diff. The headers still come through in the response as type text/html. The set_header is the first thing in my controller.

Paul