User Guide
Appendix C - PHP3 Script Examples
Axis Communications AB does not provide support for application development of any kind. The
information here is provided "as is", and there is no guarantee that any of the examples shown
will work in your particular application.
Revision 0.9 May 2001 64
if(!ftp_put($session, $dest,
$source_file, FTP_BINARY))
{ // Upload the source file
$failures++;
error_log("Could not upload file
".$source_file." as ".$dest." on
".$ftp_server,0);
}
else
{ // If successful upload,
//remove the uploaded file
//indicating capture of a
//new image
$failures=0;
unlink($source_file);
}
error_reporting(E_ALL);
}
else
{
error_reporting(E_ALL);
$failures++;
error_log("No such file:
".$source_file,0);
}
$current_time = gettimeofday();
$ellapsed = ($current_time["sec"] -
$loop_start["sec"]) * 1000000;
if($current_time["usec"] >
$loop_start["usec"])
$ellapsed += $current_time["usec"] -
$loop_start["usec"];
else
$ellapsed -= $current_time["usec"] -
$loop_start["usec"];
$wait = ($delay * 1000) /
strlen($seq_sources);
error_reporting(0);
if(is_file($alarm_file))
{
handle_alarm($session,$alarm_file);
}
error_reporting(E_ALL);
if($ellapsed < $wait)
{ // Wait if needed (in order
//to follow the delay
//specified and spread the
//traffic)
usleep($wait - $ellapsed);
}










