Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connection problem #70

Open
haseebhk22 opened this issue Jan 31, 2019 · 11 comments
Open

connection problem #70

haseebhk22 opened this issue Jan 31, 2019 · 11 comments

Comments

@haseebhk22
Copy link

haseebhk22 commented Jan 31, 2019

connection problem i have done everything but i got an error
Fatal error: Uncaught exception 'TADPHP\Exceptions\ConnectionError' with message 'Imposible iniciar conexión con dispositivo 192.168.2.200' in C:\wamp64\www\tad\lib\TAD.php on line

Here is my code

`<?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';

 $tad_factory = new TADPHP\TADFactory();

 use TADPHP\TADFactory;
 use TADPHP\TAD;
 $comands = TAD::commands_available();
 $options =array(
				'ip' => '192.168.2.200',   //Any of the above IP addresses from image above
				'internal_id' => 100,    // 1 by default.
				'com_key' => 123,        // 0 by default.
				'description' => 'TAD1', // 'N/A' by default.
				'soap_port' => 80,     // 80 by default,
				'udp_port' => 4370,      // 4370 by default.
				'encoding' => 'utf-8'    // iso8859-1 by default.
				);
  $tad_factory = new TADFactory($options);
  $tad = $tad_factory->get_instance();  
  $logs = $tad->get_att_log();
  var_dump($logs);

?>`

@haseebhk22
Copy link
Author

can any one help me please

@send2dawood
Copy link

send2dawood commented Jan 31, 2019 via email

@haseebhk22
Copy link
Author

I have wirking code i will share it with you

On Thu, 31 Jan 2019, 1:31 pm haseebhk22 @.*** wrote: can any one help me please — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#70 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5w57LZjdYHEUhXpkyf-lMt7cAhZYBiks5vIqnNgaJpZM4abzx1 .

yes please i will be thankful if you share your working code

@send2dawood
Copy link

send2dawood commented Feb 8, 2019 via email

@haseebhk22
Copy link
Author

require 'vendor/autoload.php'; require 'tad/lib/TADFactory.php'; require 'tad/lib/TAD.php'; require 'tad/lib/TADResponse.php'; require 'tad/lib/TADPHP/Providers/TADSoap.php'; require 'tad/lib/TADPHP/Providers/TADZKLib.php'; require 'tad/lib/TADPHP/Exceptions/ConnectionError.php'; require 'tad/lib/TADPHP/Exceptions/FilterArgumentError.php'; require 'tad/lib/TADPHP/Exceptions/UnrecognizedArgument.php'; require 'tad/lib/TADPHP/Exceptions/UnrecognizedCommand.php'; use TADPHP\TADFactory; use TADPHP\TAD; try { $tad = (new TADFactory(['ip' => '182.180.150.260','com_key'=>0]))->get_instance(); if($tad->is_alive()) { //$tad->disable(); $att_logs = $tad->get_att_log(); $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 { 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'); }

On Thu, Feb 7, 2019 at 3:07 PM Haseeb khan @.> wrote: I have wirking code i will share it with you … <#m_-7494239903006511939_> On Thu, 31 Jan 2019, 1:31 pm haseebhk22 @. wrote: can any one help me please — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#70 (comment) <#70 (comment)>>, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5w57LZjdYHEUhXpkyf-lMt7cAhZYBiks5vIqnNgaJpZM4abzx1 . yes please i will be thankful if you share your working code — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#70 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5w5zt_dSgUfEiv1Mh-FpaYJpla4HB0ks5vK_rWgaJpZM4abzx1 .

Thanks for sharing code but where is vedor/autoload.php this file is not exist

@send2dawood
Copy link

send2dawood commented Feb 12, 2019 via email

@haseebhk22
Copy link
Author

you have to download it from github On Mon, Feb 11, 2019 at 11:33 AM Haseeb khan [email protected] wrote:

require 'vendor/autoload.php'; require 'tad/lib/TADFactory.php'; require 'tad/lib/TAD.php'; require 'tad/lib/TADResponse.php'; require 'tad/lib/TADPHP/Providers/TADSoap.php'; require 'tad/lib/TADPHP/Providers/TADZKLib.php'; require 'tad/lib/TADPHP/Exceptions/ConnectionError.php'; require 'tad/lib/TADPHP/Exceptions/FilterArgumentError.php'; require 'tad/lib/TADPHP/Exceptions/UnrecognizedArgument.php'; require 'tad/lib/TADPHP/Exceptions/UnrecognizedCommand.php'; use TADPHP\TADFactory; use TADPHP\TAD; try { $tad = (new TADFactory(['ip' => '182.180.150.260','com_key'=>0]))->get_instance(); if($tad->is_alive()) { //$tad->disable(); $att_logs = $tad->get_att_log(); $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 { 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'); } … <#m_8444458323558097279_> On Thu, Feb 7, 2019 at 3:07 PM Haseeb khan @.> wrote: I have wirking code i will share it with you … <#m_-7494239903006511939_> On Thu, 31 Jan 2019, 1:31 pm haseebhk22 @. wrote: can any one help me please — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#70 <#70> (comment) <#70 (comment) <#70 (comment)>>>, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5w57LZjdYHEUhXpkyf-lMt7cAhZYBiks5vIqnNgaJpZM4abzx1 . yes please i will be thankful if you share your working code — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#70 (comment) <#70 (comment)>>, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5w5zt_dSgUfEiv1Mh-FpaYJpla4HB0ks5vK_rWgaJpZM4abzx1 . Thanks for sharing code but where is vedor/autoload.php this file is not exist — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#70 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5w56c8SBq16KrwJfhPd3A8UVEmw1Prks5vMQ7AgaJpZM4abzx1 .

sir i already download from github but in the folder the vendor folder or autoload.php not exist

@zkenstein
Copy link

Run this on tad folder php composer.phar dump-autoload to create autoload file

@haseebhk22
Copy link
Author

haseebhk22 commented Apr 27, 2019

Run this on tad folder php composer.phar dump-autoload to create autoload file

Sir I have done this now in your code that you provide , I change the ip address but result is the same no connection is made :
Here is my code :
`<?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' =>
'MY.IP.ADDRESS','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');
}

?>`

@haseebhk22
Copy link
Author

@zkenstein
Sir my attendance machine is running and the Zk software is successfully connected to the machine and I can get all the attendance but when i use TAD class there is always connection problem . Can you help me what is the reason ??

@haseebhk22
Copy link
Author

@zkenstein
When i run your code i got this error :
Fatal error: Call to undefined function my_log() in C:\wamp64\www\tad_php\index.php on line 62

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants