I want a long looped script to work in the background! ???
Posted: Sat Mar 20, 2004 12:40 pm
Here is a brieef description
I have a function send_ad(...) that submits an ad to remote form page using cURL functions - works well.
Finction send ad(..) is called from a loop inside other function send_to_all(...)
which goes through many (20-200) of these form pages.
This also works well. The only thing - it takes time and makes the browser busy waiting for the results. I want the browser to disconnect and be free for other use immediately after the user clicks on "Proceed" button that starts submission process.
Here is what I tried:
if ($action == 'proceed') {
echo "<p>Submission started, you can leave this page now!</P>";
for($j = 0; $j < 300; $j++) {
echo ' ';
}
flush();
ob_flush();
send_to_all($user,$mess_id,$today);
exit;
}
I wanted the page to display the message " Submission started..." right after the user vlicks on proceed and the script in send-to_all() function to proceeed.
Instead the browser is waiting for send_to_all() function to complet and onlt THEN displayes the message. It looks like neither flush() nor ob_flash don't work.
If I quit the browser, the function continues to work until completion.
What is wrong??
I have a function send_ad(...) that submits an ad to remote form page using cURL functions - works well.
Finction send ad(..) is called from a loop inside other function send_to_all(...)
which goes through many (20-200) of these form pages.
This also works well. The only thing - it takes time and makes the browser busy waiting for the results. I want the browser to disconnect and be free for other use immediately after the user clicks on "Proceed" button that starts submission process.
Here is what I tried:
if ($action == 'proceed') {
echo "<p>Submission started, you can leave this page now!</P>";
for($j = 0; $j < 300; $j++) {
echo ' ';
}
flush();
ob_flush();
send_to_all($user,$mess_id,$today);
exit;
}
I wanted the page to display the message " Submission started..." right after the user vlicks on proceed and the script in send-to_all() function to proceeed.
Instead the browser is waiting for send_to_all() function to complet and onlt THEN displayes the message. It looks like neither flush() nor ob_flash don't work.
If I quit the browser, the function continues to work until completion.
What is wrong??