How to set Content-type text/plain

How to set Content-type text/plain

am 26.03.2010 14:38:49 von Guus Ellenkamp

I have the following lines in my PHP code:

header('Content-type: text/plain; charset=utf-8');
echo 'Invalid command';

However, the output is:

HTTP/1.1 200 OK
Date: Fri, 26 Mar 2010 13:30:08 GMT
Server: Apache/2.0.55 (Win32) PHP/5.1.4
X-Powered-By: PHP/5.1.4
Set-Cookie:
http://groepskorting.megaheights.net_sfx=j1cujiemeelf4iqpepq lqub5n3;
path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache
Set-Cookie: 98defd6ee70dfb1dea416cecdf391f58=-; path=/
Content-Length: 13
Content-Type: text/html

Invalid task

Why is the Content-Type text/html and not text/plain?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: How to set Content-type text/plain

am 26.03.2010 14:44:31 von Robert Cummings

Guus Ellenkamp wrote:
> I have the following lines in my PHP code:
>
> header('Content-type: text/plain; charset=utf-8');
> echo 'Invalid command';
>
> However, the output is:
>
> HTTP/1.1 200 OK
> Date: Fri, 26 Mar 2010 13:30:08 GMT
> Server: Apache/2.0.55 (Win32) PHP/5.1.4
> X-Powered-By: PHP/5.1.4
> Set-Cookie:
> http://groepskorting.megaheights.net_sfx=j1cujiemeelf4iqpepq lqub5n3;
> path=/
> Expires: Thu, 19 Nov 1981 08:52:00 GMT
> Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
> pre-check=0
> Pragma: no-cache
> Set-Cookie: 98defd6ee70dfb1dea416cecdf391f58=-; path=/
> Content-Length: 13
> Content-Type: text/html
>
> Invalid task
>
> Why is the Content-Type text/html and not text/plain?

Is another header sent later in the program flow? It would supercede
previous headers. Try setting the replace parameter in the call to false
and then check the head response.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: How to set Content-type text/plain

am 26.03.2010 15:05:39 von Guus Ellenkamp

Sorry, my mistake... Never trapped a computer on this kind of mistakes. I
never arrived at those lines hehehehe. Sorry.

Robert, thanks, you brought the idea to check further.

"Robert Cummings" wrote in message
news:4BACBA3F.6050809@interjinn.com...
> Guus Ellenkamp wrote:
>> I have the following lines in my PHP code:
>>
>> header('Content-type: text/plain; charset=utf-8');
>> echo 'Invalid command';
>>
>> However, the output is:
>>
>> HTTP/1.1 200 OK
>> Date: Fri, 26 Mar 2010 13:30:08 GMT
>> Server: Apache/2.0.55 (Win32) PHP/5.1.4
>> X-Powered-By: PHP/5.1.4
>> Set-Cookie:
>> http://groepskorting.megaheights.net_sfx=j1cujiemeelf4iqpepq lqub5n3;
>> path=/
>> Expires: Thu, 19 Nov 1981 08:52:00 GMT
>> Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
>> pre-check=0
>> Pragma: no-cache
>> Set-Cookie: 98defd6ee70dfb1dea416cecdf391f58=-; path=/
>> Content-Length: 13
>> Content-Type: text/html
>>
>> Invalid task
>>
>> Why is the Content-Type text/html and not text/plain?
>
> Is another header sent later in the program flow? It would supercede
> previous headers. Try setting the replace parameter in the call to false
> and then check the head response.
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php