cobisja / tad-php

PHP Library for ZK Time & Attendance Devices
MIT License
213 stars 159 forks source link

how to monitor live attendance? neeed help....! #49

Open zainqayyum954 opened 6 years ago

cobisja commented 6 years ago

Hi,

You have to implement some kind of polling mechanism. TAD-PHP does not have any method for polling attendance.

Best regards,

El mié., 11 de abr. de 2018 3:49 a. m., zainqayyum954 < notifications@github.com> escribió:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cobisja/tad-php/issues/49, or mute the thread https://github.com/notifications/unsubscribe-auth/AJzLMhl5mW5OUtAv9mbNE8ysDL902hRWks5tnbV4gaJpZM4TPh_v .

zainqayyum954 commented 6 years ago

is there any command (for socket) not used by this library?

zainqayyum954 commented 6 years ago

can i set a socket listener on machine? for example: when someone scan fingerprint, i will capture those details from socket.

redone147 commented 6 years ago

Hi, You can make cronjobs.bat to save new data from device to mysql with loop 10 seconds. and call data saved from mysql to datatables like bootsrap datatables and make refresh automaticaly with oTable.fndraw(); this solution work with me.

thank u.

whoamikenken commented 5 years ago

If your device has an adms function it can send it the host PC.

`<?php // by John Schimmel // modified from the code at http://www.zend.com/pecl/tutorials/sockets.php // // run this from terminal on mac os x or another command line interface.

// Set time limit to indefinite execution set_time_limit (0);

// Set the ip and port we will listen on $address = '192.168.2.140'; $port = 8081;

// Create a TCP Stream socket $sock = socket_create(AF_INET, SOCK_STREAM, 0); echo "PHP Socket Server started at " . $address . " " . $port . "\n";

// Bind the socket to an address/port socket_bind($sock, $address, $port) or die('Could not bind to address'); // Start listening for connections socket_listen($sock);

//loop and listen

while (true) { / Accept incoming requests and handle them as child processes / $client = socket_accept($sock);

// Read the input from the client – 1024 bytes
    // Display output back to client 

$message = '';
$next = ''; 

//loop through to continue appending until everything has been read
while($next = socket_read($client, 4096)){
    $message .= $next;
}
echo $message;

$date = date('D, d M Y H:i:s');

socket_write($client, "HTTP/1.1 200 OK\r\nServer: nginx/0.8.12\r\nContent-Type: text/plain\r\nConnection: close\r\nDate: ".$date." GMT\r\nContent-Length: 2\r\n

OK:1\r\nPOST from: 3570180360214\r\n\r\n");

// display input on server side

}

// Close the client (child) socket socket_close($client);

// Close the master sockets socket_close($sock); ?>`