Updating only takes a few seconds provided the remote computer is switched on, so unless there is a much better way of updating rather than requiring a user to visit a page so it can update, I have this problem:
If the master computer is not on, obviously it cant connect to it, and therefore should give up. Now, for some reason, my 5 second time limit kinda doesn't work:
Code: Select all
// Attempt FTP connection to master computer
// Connect
set_time_limit(5);
$connection = ftp_connect('******************');
// Login
$login_result = ftp_login($connection, '****', '****');
// Check open
if ((!$connection) || (!$login_result)) {
ftp_close($connection);
} else {
// 100 Continue
// Retrive Excel file from FTP
// Open temporary file for storage
$tempfile = './sqlupdate/updatefile.xls';
$handle = fopen($tempfile, 'w');
etc...Obviously it's not 5 seconds...Fatal error: Maximum execution time of 5 seconds exceeded in sqlupdater.php on line 9 (the initial connection)
Any ideas?