Axis 2401 - PHP3 GUIDE Informações Técnicas Página 32

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
Vista de página 31
An Introduction to PHP3
Axis Communications AB provides NO 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 1.02 October 2002 32
4.2.3 Example 3 – FTP and E-mail on Event
This script will upload 2 pre-alarm and 2 post-alarm images via FTP and also send an e-mail as
notification of the event. In addition to the parameters in example 1, the following parameters are
added:
<?
$smtp_server = "mail.somewhere.com";// The server to use as mail server
$subject = "'Alarm trigged'"; // The subject to use in the mail
$from = "[email protected]"; // The specified sender
$reply = " [email protected] ";// The specified recipient
$cc = " [email protected] "; // The specified recipient of a
//copy of this mail
$body = "/tmp/var/log/messages"; // The body to insert into the
// mail. Note that this must be
//specified and point to a valid
//file
$to = " [email protected] "; // The specified recipient
The script itself is identical to example 1, except for the extra lines shown below.
for($c=0;$c<(strlen($sources));$c++)
{
$command="bufferd -stop -buffername
".$buffer_prefix.substr($sources,$c,1);
system($command);
}
//This is where the code specific to Example 2 starts.
$command = "smtpclient";
$command .=" -L -S ".$smtp_server;
$command .=" -s ".$subject;
$command .=" -f ".$from;
$command .=" -r ".$reply;
$command .=" -c ".$cc;
$command .=" -b ".$body;
$command .=" ".$to;
exec($command);
//This is where the code specific to Example 2 ends.
error_reporting(0);
………………the rest of the script as for example 1.
Vista de página 31
1 2 ... 27 28 29 30 31 32 33 34 35 36 37 ... 84 85

Comentários a estes Manuais

Sem comentários