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 48
$dest .= ".jpg";
error_reporting(0);
if(is_file($source_file))
{ // If the source file is a
//present
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);
}
}
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($sources);
if($ellapsed < $wait)
{ // Wait if needed (in order to
//follow the delay specified
//and spread the traffic)
usleep($wait - $ellapsed);
}
// Calculate session time
$session_time = ($current_time["sec"] -
$start_time["sec"]);










