Current location: Hot Scripts Forums » Programming Languages » PHP » Using crond to run a php script with redirect and refresh


Using crond to run a php script with redirect and refresh

Reply
  #1 (permalink)  
Old 02-09-04, 06:44 AM
php_newbie php_newbie is offline
New Member
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Using crond to run a php script with redirect and refresh

Hi,

I have been trying to use the Cron Daemon to run a php script using lynx. Everything works except for one problem.

The php script I've got runs in stages i.e after stage 1, the page is redirected to stage 2 and so on until the processing is over. There are also a few refresh commands in there achieved by means of javascript.

The script works perfectly from a browser but from the Crond interface using lynx, it gets stuck as the first stage and cannot redirect and carry on the processing.

Is there any solution to this problem?

Any feedback will be much appreciated.

Thanks.
Reply With Quote
  #2 (permalink)  
Old 02-09-04, 09:38 AM
Ice_Metal Ice_Metal is offline
Newbie Coder
 
Join Date: Jan 2004
Location: Ontario, Canada
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
have you thought about using the sleep() function in php to try and to the same thing as the java script. theres 2 methods in php code to do this. Either sleep() or unsleep()
sleep ( The Time you want in seconds );
unsleep ( The Time You Want in milliseconds );

That should do the trick... and theres fuctions are already a php predefined function.
Reply With Quote
  #3 (permalink)  
Old 02-09-04, 12:03 PM
php_newbie php_newbie is offline
New Member
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re:

Hi Ice_Metal,

Thanks for the feedback.

I'm not sure I used the right technical words but what I mean by "redirect" is this.

Code:
echo "<META HTTP-EQUIV=\"refresh\" content=\"0;URL=nextstage\">";
So it seems that the script stops here and cannot go to the next stage and do further processing. I will try to use the PHP header() function and see if I have more success with that one.

As far as the javascript part is concerned, this is yet another problem because I don't know if either lynx or wget can execute javascript. Actually, the task of the javascipt in this script is to refresh/reload the page - so I don't think the sleep()/unsleep() functions applies here.

If you find anything new, please do post it here. I think it could interest a lot of people to know how to do this because processing in stages is a way to 'counter' the problem of maximum execution time on servers.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 08:46 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.