I'm using TAD class php for connection to a attendance machine but I tried so many solutions and codes but I failed can any one help me please.
This is for my attendance management system using php codeigniter now I am using a manual method for getting attendance from machine to MySql. Everyday early morning i download all the attendance from the machine using Software which was provided by the machine company and then the software download all the attendance logs into a MS Access db file and then i read the attendance from this file.But now I want a direct connection to machine. Here is some code that i tried using TAD class but as always i got a connection error.
<?php
require 'vendor/autoload.php';
require 'lib/TADFactory.php';
require 'lib/TAD.php';
require 'lib/TADResponse.php';
require 'lib/Providers/TADSoap.php';
require 'lib/Providers/TADZKLib.php';
require 'lib/Exceptions/ConnectionError.php';
require 'lib/Exceptions/FilterArgumentError.php';
require 'lib/Exceptions/UnrecognizedArgument.php';
require 'lib/Exceptions/UnrecognizedCommand.php';
use TADPHP\TADFactory;
use TADPHP\TAD;
try {
$tad = (new TADFactory(['ip' =>
'192.168.2.200','com_key'=>0]))->get_instance();
if($tad->is_alive())
{
echo "done";exit();
//$tad->disable();
$att_logs = $tad->get_att_log();
// print_r($att_logs);exit();
$att_logs=$att_logs->filter_by_date(['start' => date('Y-m-d'),'end' =>
date('Y-m-d')]);
if ($att_logs->is_empty_response())
{
my_log('Does not have logs recorded');
//continue;
}
else
{
$array_att_logs = $att_logs->to_array();
$device_logs = array();
$counter=1;
if(!empty($array_att_logs))
foreach($array_att_logs as $key =>$val )
{
foreach($val as $log)
{
$device_logs[]= array(
'institutes_inst_id' => $row['inst_id'],
'employees_machine_user_id' => $log['PIN'],
'date' => date('Y-m-d',strtotime($log['DateTime'])),
'time' => date('H:i:s',strtotime($log['DateTime']))
);
$counter++;
}
}
add_att_logs($device_logs);
//$tad->enable();
my_log('Device in ' . $row['inst_name']. '['.$row['ip_address']. '] has ' .
$counter . ' records');
}
}
else
{
echo "not";exit();
my_log('Device in ' . $row['inst_name'] . ' is off-line');
continue;
}
}
catch(Exception $e)
{
my_log('Device in ' . $row['inst_name']. '['.$row['ip_address']. '] is
offline');
}
?>
From "Access Control Software" get the 'ip' and 'comm_key' for the device. Maybe your ip and comm_key that you are providing here
$tad = (new TADFactory(['ip' =>'192.168.2.200','com_key'=>0]))->get_instance();
is wrong.
Also you need to enable php_sockets.dll and php_soap.dll in your php.ini file.