Re: Need some help on header refresh...



Justin wrote:
On Mar 3, 11:29 am, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:
Justin wrote:
Harlow... i need some help on these... im actually trying to do a page
using php... the function is to receive certain parameters from a 3rd
party provider... and i need to redirect my page to another page after
certain validation. it's ok when i use the url to do the testing...
the validation part works fine... scenario as below:
if situation a, echo abc
if situation b, echo abc then refresh to another page.
the problem is after the 3rd party call my page the refresh doesnt
work... after doing some amendments, it redirects to another page but
doesnt echo abc... so any other way to redirect the page??? tried
output buffer start and flush but still couldn.... SOS...
Regards,
Justin
You can use header() calls to redirect, but it is incompatible with
echo(). You can't send ANY output to the browser before a header() call.

But if you're redirecting, any output you send would not be displayed
anyway - so why bother sending it?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@xxxxxxxxxxxxx
==================

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.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.



Relevant Pages

  • Re: sessions and redirecting in opera
    ... All the more reason why a header redirect should be ... Opera get's the redirect, but still has the page with the same ... exit(); // exit doesn't really make a difference for Opera ...
    (comp.lang.php)
  • Re: cant redirect to Excel
    ... I want to do is redirect to Excel in the case of the External user. ... Cannot modify header information - headers already sent by ... I think it is because it has to get the output first from the string ...
    (comp.lang.php)
  • Re: sessions and redirecting in opera
    ... All the more reason why a header redirect should be accompanied by ... Opera get's the redirect, but still has the page with the same ... exit(); // exit doesn't really make a difference for Opera ...
    (comp.lang.php)
  • Re: sessions and redirecting in opera
    ... Or could it perhaps be that Opera indeed thinks that it ... that redirected to the login page in the first place. ... All the more reason why a header redirect should be accompanied by ...
    (comp.lang.php)
  • Re: [PHP] Any way to use header() or another function to force user to "top level"
    ... to is loading within the <div> tags and at the top level of the ... causing the browser to load /some_url as if accessed directly. ... Once I make the call to header(), I no longer care about any state ... header/location redirect method. ...
    (php.general)