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 want a long looped script to work in the background! ???
Moderator: General Moderators
-
jollyjumper
- Forum Contributor
- Posts: 107
- Joined: Sat Jan 25, 2003 11:03 am
Hi Alexiz,
I think the exec function is what you need. You can find more information about this function on http://www.php.net
Greetz Jolly.
I think the exec function is what you need. You can find more information about this function on http://www.php.net
Greetz Jolly.
Thanks!
I really need to read more on the subject. I even don't understand what could be the "program" that is to be a parameter for exec() function. Could it be just a file with PHP script?
My original script files eache result in MySQL table for later viewing - is it OK?
Obviously I just don't have enough knowlege on all that!
I don't think I can use cron - I have to pass the parameters to the function that are generated by each user.
I really need to read more on the subject. I even don't understand what could be the "program" that is to be a parameter for exec() function. Could it be just a file with PHP script?
My original script files eache result in MySQL table for later viewing - is it OK?
Obviously I just don't have enough knowlege on all that!
I don't think I can use cron - I have to pass the parameters to the function that are generated by each user.
It could be the command to invoke the CLI version of the php with script name passed as the parameter:alexeiz wrote: I really need to read more on the subject. I even don't understand what could be the "program" that is to be a parameter for exec() function. Could it be just a file with PHP script?
Code: Select all
exec("/usr/local/bin/php -q /path/to/your/script.php 2>&1 >/dev/null");