non parsed header with php

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
titi74
-


Joined: 27 Sep 2005
Posts: 2

PostPosted: Tue Sep 27, 2005 3:23 am    Post subject: non parsed header with php Reply with quote

What do I need to do to get a page displayed with a non parsed header using php, I want the content to be sent directly to the output without being buffered by the server.
I looked at the documentation, it says that the first line of the output of the script has to begin with HTTP/
How do I do that? I tried header("HTTP/1.1 200"), echo "HTTP/1.1", it doesn't work.
Back to top View user's profile Send private message
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Tue Sep 27, 2005 7:47 am    Post subject: Reply with quote

I think it is:

Quote:
header("Content-type: text/html");

_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Tue Sep 27, 2005 8:28 am    Post subject: Re: non parsed header with php Reply with quote

titi74 wrote:
What do I need to do to get a page displayed with a non parsed header using php, I want the content to be sent directly to the output without being buffered by the server.
I looked at the documentation, it says that the first line of the output of the script has to begin with HTTP/
How do I do that? I tried header("HTTP/1.1 200"), echo "HTTP/1.1", it doesn't work.


Non parsed header? Elaborate.
You mean without the X-Powered-By header?
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Tue Sep 27, 2005 1:16 pm    Post subject: Re: non parsed header with php Reply with quote

titi74 wrote:
What do I need to do to get a page displayed with a non parsed header using php, I want the content to be sent directly to the output without being buffered by the server.
I looked at the documentation, it says that the first line of the output of the script has to begin with HTTP/
How do I do that? I tried header("HTTP/1.1 200"), echo "HTTP/1.1", it doesn't work.

"Non parsed header" scripts output is not processed by the web server so you will lose several benefits (such as keep alive, date generation, chunked encoding) that are done automatically by the server when running scripts in the normal mode.
But buffering is not somthing that you can disable with a NPH script. It depends on the web server. Abyss Web Server for example does not buffer scripts (whether NPH or not). But PHP have an internal buffer (see the flush() command for more information).
By the way, to have a NPH script in PHP, your first output should be generated by header and be conforming to the HTTP specification.
The following is wrong(according to HTTP):
Code:
header("HTTP/1.1 200");

This is fixed version:
Code:
header("HTTP/1.1 200 OK");

After the HTTP code, you must also add the HTTP reason.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
titi74
-


Joined: 27 Sep 2005
Posts: 2

PostPosted: Tue Sep 27, 2005 3:11 pm    Post subject: Thanks Reply with quote

Tanks you,
You're right, it had nothing to do with non parsed header,
but I had to use both flush() and ob_flush() to make it work, each alone was not enough, I saw that in the php doc.
It was much easier than I thought.
Back to top View user's profile Send private message
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Tue Sep 27, 2005 4:48 pm    Post subject: Reply with quote

Still clueless.
/me shrugs
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Wed Sep 28, 2005 12:12 pm    Post subject: Reply with quote

MonkeyNation wrote:
Still clueless.
/me shrugs


Quoted from http://www.htmlhelp.com/faq/cgifaq.2.html :

Quote:
2.6: What is NPH?
NPH = No Parsed Headers. The script undertakes to print the entire
HTTP response including all necessary header fields. The HTTPD
is thereby instructed not to parse the headers (as it would normally do)
nor add any which are missing.

_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Wed Sep 28, 2005 12:44 pm    Post subject: Reply with quote

aprelium wrote:
MonkeyNation wrote:
Still clueless.
/me shrugs


Quoted from http://www.htmlhelp.com/faq/cgifaq.2.html :

Quote:
2.6: What is NPH?
NPH = No Parsed Headers. The script undertakes to print the entire
HTTP response including all necessary header fields. The HTTPD
is thereby instructed not to parse the headers (as it would normally do)
nor add any which are missing.


Oh snap, thought NPH was something completley different. Y helo thar double meanings.
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group