The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Starting a batch file from a webpage...



Some browsers (IE) will also cancel the HTTP request after a long period of
waiting with no server output.  To avoid the consequences of this problem,
add the following lines of code. However if the browser disconnects from
the request then you won't get any output from the script or after the
system call, but it will complete correctly:

<?php
ignore_user_abort(1);
set_time_limit(0);
// echo has no effect after timeout or abort
echo system('mybatchfile.bat;');
?>

-OR-

To ensure browser holds:

<?php
set_time_limit(0);
echo 'Working...';
flush();
echo system('mybatchfile.bat;');
?>

NB: flush() has difficulties with mod_gzip


--- In ukha_d@xxxxxxx, "Shaf Ali" <shaf@s...> wrote:
> And to continue where I left off before my trigger happy email client
fires
> off......
>
> > Soz been ignoring mail :
> >
> > Try this : http://www.php.net/manual/en/function.set-time-limit.php
> >
> > Try the Apache timeout.
> >
> > If no joy create a .bat file that does nothing but sleep
>
> for say NN seconds keep increasing it.
>
> It may just be a problem with your script.
>
> Shaf



Home | Main Index | Thread Index

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.