Jump to content

Forcing a Redirect.


Sharky01276

Recommended Posts

I have a piece of code that takes a long time to run, just over one min.

 

I want to be able to force php to redirect to another page and keep this code running in the background.

I have tried using

 

header("Location: http://192.168.96.110/lcr/callhandlingmaint.php");

 

But the redirect is only run after the one minuite of code has taken place.

 

Any ideas or suggestions. Thanks in advance

 

Alan

Link to comment
https://forums.phpfreaks.com/topic/37136-forcing-a-redirect/
Share on other sites

Sharky, when you run a header redirect, you're actually messing with the HTTP headers, so this code will not be processed until the header information starts being passed through to the browser (in other words, when your PHP is through being processed). So, you'll have to find another way to get it done. If you're simply wanting to trigger a background operation to run, I'd recommend using some sort of AJAX (Javascript HTTP Request) to get the background activity started. That way, you are, in essence, running it as a completely separate server call from what the user is currently viewing.

Link to comment
https://forums.phpfreaks.com/topic/37136-forcing-a-redirect/#findComment-177353
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.