vodvud / php_zklib

GNU General Public License v2.0
24 stars 19 forks source link

Supported Model #25

Open johnebarita opened 4 years ago

johnebarita commented 4 years ago

Hi.

Thanks for the library. I just want to know what models of ZKTeco devices does the library support?

And can the library be used to get the attendance data from the zkteco device at a regular interval to provide a bit of a real-time data on my web app.

vodvud commented 4 years ago

Hello!

I just want to know what models of ZKTeco devices does the library support?

Sorry, I have not list of models but I think many models support. To check it you may use this library on your model.

And can the library be used to get the attendance data from the zkteco device at a regular interval to provide a bit of a real-time data on my web app.

Yes, sure. Best solution for attendance records: receive the attendance log hourly or more often (by Cron job), save to your own DB and remove from device. Then you may working with DB data up to you want.

Example method for get data and clear device:

/**
 * Get log from device
 *
 * @param string $ip
 * @return array
 */
public function get($ip)
{
    $log = [];

    if (!empty($ip)) {
        $zk = new ZKLib($ip);
        if ($zk->connect()) {
            $zk->disableDevice();
            $log = $zk->getAttendance();
            if (count($log) > 0) {
                $zk->clearAttendance();
            }
            $zk->enableDevice();
            $zk->disconnect();
        }
    }

    return $log;
}
johnebarita commented 4 years ago

Thanks for the response. And for those who might stumble upon this comment.

I used ZKTEco 628.