<?
// Set time limit to indefinite execution
set_time_limit(0);
// create TCP socket
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
// connect to the camera's native stream protocol IP:Port
socket_connect($sock,"10.0.0.20", 65310);
// handshake with the camera
socket_write($sock,"START\r\n");
// ignore the handshake response
socket_read($sock, 12000);
// daemonize this script
while (true) {
    
// simulate 4 escape sequences "\0A" with "\r\n" - or chr(0)
    
socket_write($sock,"\r\n\r\n\r\n\r\n");
    
// read the image from the stream (max 80k)
    
print socket_read($sock, 80000);
    
// limit to ~6 frames per second
    
usleep(166666);
}
?>