System information

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 27
4.2.1.1 Driver.php3
The script moves the camera according to the button pressed by the user. The HTML interface
sends a single parameter to the script: the number of the button pressed. The appropriate data is
sent to the serial port, according to the number/button pressed.
The script uses the HTTP-API (available on www.axis.com) to write data to the serial port.
<?
switch($param) // Move the camera according to the button pressed
{
case 1: // Up Left
fopen("http://127.0.0.1/axis-
cgi/com/serial.cgi?port=1\&write=FF020008003F49","w");
fopen("http://127.0.0.1/axis-
cgi/com/serial.cgi?port=1\&write=FF0200043F0045","w");
usleep(100000); // Wait 0.1 seconds
fopen("http://127.0.0.1/axis-
cgi/com/serial.cgi?port=1\&write=FF020000000002","w");
break;
case 2: // Up
fopen("http://127.0.0.1/axis-
cgi/com/serial.cgi?port=1\&write=FF020008003F49","w");
usleep(100000); // Wait 0.1 seconds
fopen("http://127.0.0.1/axis-
cgi/com/serial.cgi?port=1\&write=FF020000000002","w");
break;
case 3: // Up Right
fopen("http://127.0.0.1/axis-
cgi/com/serial.cgi?port=1\&write=FF020008003F49","w");
fopen("http://127.0.0.1/axis-
cgi/com/serial.cgi?port=1\&write=FF0200023F0043","w");
usleep(100000); // Wait 0.1 seconds
fopen("http://127.0.0.1/axis-
cgi/com/serial.cgi?port=1\&write=FF020000000002","w");
break;
case 4: // Right
fopen("http://127.0.0.1/axis-
cgi/com/serial.cgi?port=1\&write=FF0200023F0043","w");
usleep(100000); // Wait 0.1 seconds
fopen("http://127.0.0.1/axis-
cgi/com/serial.cgi?port=1\&write=FF020000000002","w");
break;
case 5: // Down Right
fopen("http://127.0.0.1/axis-
cgi/com/serial.cgi?port=1\&write=FF020010003F51","w");
fopen("http://127.0.0.1/axis-
cgi/com/serial.cgi?port=1\&write=FF0200023F0043","w");
usleep(100000); // Wait 0.1 seconds
fopen("http://127.0.0.1/axis-
cgi/com/serial.cgi?port=1\&write=FF020000000002","w");