FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » header function
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
header function [message #172159] Wed, 02 February 2011 12:16 Go to next message
me is currently offline  me
Messages: 192
Registered: September 2010
Karma: 0
Senior Member
If somepage.php is loaded in a browser, and a script external to
somepage.php that contains header('Location: somepage.php') is triggered
by some event, will that call have the effect of refreshing somepage.php?

php.net notes that the "location' string returns a redirect (302) status
code to the browser. Under these circumstances, the redirect triggered
by the external script points to the same page currently loaded in the
browser. Will that choke the browser in any way?

Thank you,

Bill B
Re: header function [message #172160 is a reply to message #172159] Wed, 02 February 2011 12:23 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 2/2/2011 7:16 AM, Bill B wrote:
> If somepage.php is loaded in a browser, and a script external to
> somepage.php that contains header('Location: somepage.php') is triggered
> by some event, will that call have the effect of refreshing somepage.php?
>
> php.net notes that the "location' string returns a redirect (302) status
> code to the browser. Under these circumstances, the redirect triggered
> by the external script points to the same page currently loaded in the
> browser. Will that choke the browser in any way?
>
> Thank you,
>
> Bill B

How is an external script going to trigger a header call? HTTP is a
request/response protocol; you can't "push" data to the client.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: header function [message #172161 is a reply to message #172160] Wed, 02 February 2011 12:38 Go to previous messageGo to next message
me is currently offline  me
Messages: 192
Registered: September 2010
Karma: 0
Senior Member
On 2/2/2011 7:23 AM, Jerry Stuckle wrote:
> On 2/2/2011 7:16 AM, Bill B wrote:
>> If somepage.php is loaded in a browser, and a script external to
>> somepage.php that contains header('Location: somepage.php') is triggered
>> by some event, will that call have the effect of refreshing somepage.php?
>>
>> php.net notes that the "location' string returns a redirect (302) status
>> code to the browser. Under these circumstances, the redirect triggered
>> by the external script points to the same page currently loaded in the
>> browser. Will that choke the browser in any way?
>>
>> Thank you,
>>
>> Bill B
>
> How is an external script going to trigger a header call? HTTP is a
> request/response protocol; you can't "push" data to the client.
>

It is a "listener" script, waiting for data to be sent from another
source, PayPal in this case.

Bill B
Re: header function [message #172162 is a reply to message #172159] Wed, 02 February 2011 12:39 Go to previous messageGo to next message
Erwin Moller is currently offline  Erwin Moller
Messages: 228
Registered: September 2010
Karma: 0
Senior Member
On 2/2/2011 1:16 PM, Bill B wrote:
> If somepage.php is loaded in a browser, and a script external to
> somepage.php that contains header('Location: somepage.php') is triggered
> by some event, will that call have the effect of refreshing somepage.php?

Bad question. :-)
Let me explain.

Script1: somepage.php

Script2: anotherScript.php
This script contains ONLY header('Location: somepage.php') (for
simplicities sake), so:
<?php
// This is anotherScript.php
header('Location: somepage.php');
exit;
?>

Now, suppose somebody (MrX) has the output of somepage.php in the browser.
And then what happens? (your 'triggered by some event' is a bit vague,
but I think I understand what you mean.)
MrZ now loads anotherScript.php in his browser.
That will result in a header response from the server to the browser.
This response instructs (suggests) the browser of Mr.Z to go to
somepage.php instead.
So Mr.Z will see whatever-it-is-that-somepage.php-produces too.



>
> php.net notes that the "location' string returns a redirect (302) status
> code to the browser. Under these circumstances, the redirect triggered
> by the external script points to the same page currently loaded in the
> browser. Will that choke the browser in any way?
>

I hope this question vanishes after my above explanation.

Regards,
Erwin Moller

> Thank you,
>
> Bill B


--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
Re: header function [message #172164 is a reply to message #172161] Wed, 02 February 2011 13:10 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 2/2/2011 7:38 AM, Bill B wrote:
> On 2/2/2011 7:23 AM, Jerry Stuckle wrote:
>> On 2/2/2011 7:16 AM, Bill B wrote:
>>> If somepage.php is loaded in a browser, and a script external to
>>> somepage.php that contains header('Location: somepage.php') is triggered
>>> by some event, will that call have the effect of refreshing
>>> somepage.php?
>>>
>>> php.net notes that the "location' string returns a redirect (302) status
>>> code to the browser. Under these circumstances, the redirect triggered
>>> by the external script points to the same page currently loaded in the
>>> browser. Will that choke the browser in any way?
>>>
>>> Thank you,
>>>
>>> Bill B
>>
>> How is an external script going to trigger a header call? HTTP is a
>> request/response protocol; you can't "push" data to the client.
>>
>
> It is a "listener" script, waiting for data to be sent from another
> source, PayPal in this case.
>
> Bill B

That doesn't matter. The question is - how is this script going to send
a Location: header (or any other data) without a request from the client?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: header function [message #172165 is a reply to message #172161] Wed, 02 February 2011 13:11 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 2/2/2011 7:38 AM, Bill B wrote:
> On 2/2/2011 7:23 AM, Jerry Stuckle wrote:
>> On 2/2/2011 7:16 AM, Bill B wrote:
>>> If somepage.php is loaded in a browser, and a script external to
>>> somepage.php that contains header('Location: somepage.php') is triggered
>>> by some event, will that call have the effect of refreshing
>>> somepage.php?
>>>
>>> php.net notes that the "location' string returns a redirect (302) status
>>> code to the browser. Under these circumstances, the redirect triggered
>>> by the external script points to the same page currently loaded in the
>>> browser. Will that choke the browser in any way?
>>>
>>> Thank you,
>>>
>>> Bill B
>>
>> How is an external script going to trigger a header call? HTTP is a
>> request/response protocol; you can't "push" data to the client.
>>
>
> It is a "listener" script, waiting for data to be sent from another
> source, PayPal in this case.
>
> Bill B

To clarify - when using the HTTP protocol, the server cannot initiate
events in the client. The client MUST request something from the
server, and the server responds.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: header function [message #172166 is a reply to message #172164] Wed, 02 February 2011 13:49 Go to previous messageGo to next message
me is currently offline  me
Messages: 192
Registered: September 2010
Karma: 0
Senior Member
On 2/2/2011 8:10 AM, Jerry Stuckle wrote:
> On 2/2/2011 7:38 AM, Bill B wrote:
>> On 2/2/2011 7:23 AM, Jerry Stuckle wrote:
>>> On 2/2/2011 7:16 AM, Bill B wrote:
>>>> If somepage.php is loaded in a browser, and a script external to
>>>> somepage.php that contains header('Location: somepage.php') is
>>>> triggered
>>>> by some event, will that call have the effect of refreshing
>>>> somepage.php?
>>>>
>>>> php.net notes that the "location' string returns a redirect (302)
>>>> status
>>>> code to the browser. Under these circumstances, the redirect triggered
>>>> by the external script points to the same page currently loaded in the
>>>> browser. Will that choke the browser in any way?
>>>>
>>>> Thank you,
>>>>
>>>> Bill B
>>>
>>> How is an external script going to trigger a header call? HTTP is a
>>> request/response protocol; you can't "push" data to the client.
>>>
>>
>> It is a "listener" script, waiting for data to be sent from another
>> source, PayPal in this case.
>>
>> Bill B
>
> That doesn't matter. The question is - how is this script going to send
> a Location: header (or any other data) without a request from the client?
>

The request is received from PayPal. Related information...this same
listener script a) receives data from PayPal, b) sends data back top
PayPal, then c) receives validation from PayPal (or not, depending). The
script is successfully causing the data received from PayPal to be
written to a MySQL database. So the script is executing.

Bill B

P.S. to Erwin, thank you, still processing the information, appreciate
the help.
Re: header function [message #172167 is a reply to message #172166] Wed, 02 February 2011 13:56 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 2/2/2011 8:49 AM, Bill B wrote:
> On 2/2/2011 8:10 AM, Jerry Stuckle wrote:
>> On 2/2/2011 7:38 AM, Bill B wrote:
>>> On 2/2/2011 7:23 AM, Jerry Stuckle wrote:
>>>> On 2/2/2011 7:16 AM, Bill B wrote:
>>>> > If somepage.php is loaded in a browser, and a script external to
>>>> > somepage.php that contains header('Location: somepage.php') is
>>>> > triggered
>>>> > by some event, will that call have the effect of refreshing
>>>> > somepage.php?
>>>> >
>>>> > php.net notes that the "location' string returns a redirect (302)
>>>> > status
>>>> > code to the browser. Under these circumstances, the redirect triggered
>>>> > by the external script points to the same page currently loaded in the
>>>> > browser. Will that choke the browser in any way?
>>>> >
>>>> > Thank you,
>>>> >
>>>> > Bill B
>>>>
>>>> How is an external script going to trigger a header call? HTTP is a
>>>> request/response protocol; you can't "push" data to the client.
>>>>
>>>
>>> It is a "listener" script, waiting for data to be sent from another
>>> source, PayPal in this case.
>>>
>>> Bill B
>>
>> That doesn't matter. The question is - how is this script going to send
>> a Location: header (or any other data) without a request from the client?
>>
>
> The request is received from PayPal. Related information...this same
> listener script a) receives data from PayPal, b) sends data back top
> PayPal, then c) receives validation from PayPal (or not, depending). The
> script is successfully causing the data received from PayPal to be
> written to a MySQL database. So the script is executing.
>
> Bill B
>
> P.S. to Erwin, thank you, still processing the information, appreciate
> the help.

But this is not the script which was building a page for the browser!

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: header function [message #172168 is a reply to message #172167] Wed, 02 February 2011 14:20 Go to previous messageGo to next message
me is currently offline  me
Messages: 192
Registered: September 2010
Karma: 0
Senior Member
On 2/2/2011 8:56 AM, Jerry Stuckle wrote:
> On 2/2/2011 8:49 AM, Bill B wrote:
>> On 2/2/2011 8:10 AM, Jerry Stuckle wrote:
>>> On 2/2/2011 7:38 AM, Bill B wrote:
>>>> On 2/2/2011 7:23 AM, Jerry Stuckle wrote:
>>>> > On 2/2/2011 7:16 AM, Bill B wrote:
>>>> >> If somepage.php is loaded in a browser, and a script external to
>>>> >> somepage.php that contains header('Location: somepage.php') is
>>>> >> triggered
>>>> >> by some event, will that call have the effect of refreshing
>>>> >> somepage.php?
>>>> >>
>>>> >> php.net notes that the "location' string returns a redirect (302)
>>>> >> status
>>>> >> code to the browser. Under these circumstances, the redirect
>>>> >> triggered
>>>> >> by the external script points to the same page currently loaded in
>>>> >> the
>>>> >> browser. Will that choke the browser in any way?
>>>> >>
>>>> >> Thank you,
>>>> >>
>>>> >> Bill B
>>>> >
>>>> > How is an external script going to trigger a header call? HTTP is a
>>>> > request/response protocol; you can't "push" data to the client.
>>>> >
>>>>
>>>> It is a "listener" script, waiting for data to be sent from another
>>>> source, PayPal in this case.
>>>>
>>>> Bill B
>>>
>>> That doesn't matter. The question is - how is this script going to send
>>> a Location: header (or any other data) without a request from the
>>> client?
>>>
>>
>> The request is received from PayPal. Related information...this same
>> listener script a) receives data from PayPal, b) sends data back top
>> PayPal, then c) receives validation from PayPal (or not, depending). The
>> script is successfully causing the data received from PayPal to be
>> written to a MySQL database. So the script is executing.
>>
>> Bill B
>>
>> P.S. to Erwin, thank you, still processing the information, appreciate
>> the help.
>
> But this is not the script which was building a page for the browser!
>

Now I get it. Although you kept repeating the same thing, it just now
sunk in.

Thank you,

Bill B
Re: header function [message #172169 is a reply to message #172167] Wed, 02 February 2011 14:28 Go to previous messageGo to next message
me is currently offline  me
Messages: 192
Registered: September 2010
Karma: 0
Senior Member
On 2/2/2011 8:56 AM, Jerry Stuckle wrote:
> On 2/2/2011 8:49 AM, Bill B wrote:
>> On 2/2/2011 8:10 AM, Jerry Stuckle wrote:
>>> On 2/2/2011 7:38 AM, Bill B wrote:
>>>> On 2/2/2011 7:23 AM, Jerry Stuckle wrote:
>>>> > On 2/2/2011 7:16 AM, Bill B wrote:
>>>> >> If somepage.php is loaded in a browser, and a script external to
>>>> >> somepage.php that contains header('Location: somepage.php') is
>>>> >> triggered
>>>> >> by some event, will that call have the effect of refreshing
>>>> >> somepage.php?
>>>> >>
>>>> >> php.net notes that the "location' string returns a redirect (302)
>>>> >> status
>>>> >> code to the browser. Under these circumstances, the redirect
>>>> >> triggered
>>>> >> by the external script points to the same page currently loaded in
>>>> >> the
>>>> >> browser. Will that choke the browser in any way?
>>>> >>
>>>> >> Thank you,
>>>> >>
>>>> >> Bill B
>>>> >
>>>> > How is an external script going to trigger a header call? HTTP is a
>>>> > request/response protocol; you can't "push" data to the client.
>>>> >
>>>>
>>>> It is a "listener" script, waiting for data to be sent from another
>>>> source, PayPal in this case.
>>>>
>>>> Bill B
>>>
>>> That doesn't matter. The question is - how is this script going to send
>>> a Location: header (or any other data) without a request from the
>>> client?
>>>
>>
>> The request is received from PayPal. Related information...this same
>> listener script a) receives data from PayPal, b) sends data back top
>> PayPal, then c) receives validation from PayPal (or not, depending). The
>> script is successfully causing the data received from PayPal to be
>> written to a MySQL database. So the script is executing.
>>
>> Bill B
>>
>> P.S. to Erwin, thank you, still processing the information, appreciate
>> the help.
>
> But this is not the script which was building a page for the browser!
>

Thanks again Erwin and Jerry. Been that kind of week so far, not a very
good grip on the obvious.

Bill B
Re: header function [message #172170 is a reply to message #172159] Wed, 02 February 2011 15:23 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On 02/02/11 12:16, Bill B wrote:
> If somepage.php is loaded in a browser, and a script external to
> somepage.php that contains header('Location: somepage.php') is triggered
> by some event, will that call have the effect of refreshing somepage.php?
>
> php.net notes that the "location' string returns a redirect (302) status
> code to the browser. Under these circumstances, the redirect triggered
> by the external script points to the same page currently loaded in the
> browser. Will that choke the browser in any way?

Once a page has been loaded in the browser, nothing that you do on the
server can cause it to be reloaded. The browser has to initiate any reload.

Also, you can't send headers after output (eg print, echo, output
sections outside the php encapsulation).

Rgds

Denis McMahon
Re: header function [message #172171 is a reply to message #172170] Wed, 02 February 2011 16:32 Go to previous message
me is currently offline  me
Messages: 192
Registered: September 2010
Karma: 0
Senior Member
On 2/2/2011 10:23 AM, Denis McMahon wrote:
> On 02/02/11 12:16, Bill B wrote:
>> If somepage.php is loaded in a browser, and a script external to
>> somepage.php that contains header('Location: somepage.php') is triggered
>> by some event, will that call have the effect of refreshing somepage.php?
>>
>> php.net notes that the "location' string returns a redirect (302) status
>> code to the browser. Under these circumstances, the redirect triggered
>> by the external script points to the same page currently loaded in the
>> browser. Will that choke the browser in any way?
>
> Once a page has been loaded in the browser, nothing that you do on the
> server can cause it to be reloaded. The browser has to initiate any reload.
>
> Also, you can't send headers after output (eg print, echo, output
> sections outside the php encapsulation).
>
> Rgds
>
> Denis McMahon

Thank you, Denis. Trying to send a header after output should have sent
up a red flag all by itself. But, alas, it did not, out to lunch early
today.

Thanks,

Bill B
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Translate business information for free
Next Topic: Shri Shraddha Astrology
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 23:48:16 GMT 2024

Total time taken to generate the page: 0.01988 seconds