|
Posted by Rik on 03/03/07 23:21
Jerry Stuckle <jstucklex@attglobal.net> wrote:
>> er... the requirement from my 3rd party provider is that i have to
>> reply -1 once receive the parameters from them.. so i put echo -1. is
>> there any other way to send instead of echo? the redirecting part is
>> something i wan to add on... it's not in the API they provided...
>>
>
> OK, you have to respond with a -1. But once you send ANY output, you
> can't use a header() call.
>
> header() must be called before the headers are sent to the browser. And
> any output - even white space - will cause the headers to be sent. So
> you can either send a response or do the redirect. But the HTTP
> protocol (not PHP) won't let you do both.
Allthough...
You can have a header redirect & output, I'm a bit fuzzy on wether this is
actually allowed with the HTTP protocol, but for instance, I can disable
automatic redirects (yes, also header redirects) in Opera, and I'll see
the content that comes next. So I see no practical reason why you cannot
send a redirect header & some content, as long as you set the header first
in PHP. There is a reason it's so often advised to die()/exit() after a
redirect statement.
--
Rik Wasmus
[Back to original message]
|