Forum Moderators: coopster

Message Too Old, No Replies

PHP header location time/timed? NOT REFRESH!

         

JAB Creations

9:33 pm on Mar 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have used a timed location in PHP before though php.net doesn't have any documentation on it. This is not refresh, it strictly must be a timed event using the header/location function!

It looks almost exactly like this...

header ("Location: [localhost...] 10);

- John

Demaestro

9:49 pm on Mar 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Correct me if I am missing something, but the PHP gets run server side before the data is transmitted to the browser. Once the user gets the page then all the PHP has been rendered, anything that runs in PHP on a timer isn't going to be seen by the browser, if you already sent them the data. You can't have PHP do something after the page has loaded, you need something on the client side to request whatever gets triggered by the PHP. Like a seperate HTTP header request or something.

Maybe I don't understand what you are asking but I don't see why you would want to do this.

If you want a .php page to be "hit" every so often because it cleans up a table or something like that then you want to set up a cron job that will execute the page.

JAB Creations

10:57 pm on Mar 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've done this before otherwise I wouldn't ask the question.

- John

Receptional Andy

10:59 pm on Mar 17, 2008 (gmt 0)



You could sleep [php.net] before sending a redirect header.

mooger35

6:50 pm on Mar 18, 2008 (gmt 0)

10+ Year Member



I don't think I've heard of header location with a timer attached to it...

If I'm going to time a redirect I use either:

<meta http-equiv="refresh" content="10;url=http://localhost/">
or
header("refresh: 10; url=http://localhost/");