cobisja / tad-php

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

Unable for connect to Device (supports web server) #35

Open salmansidd17 opened 7 years ago

salmansidd17 commented 7 years ago

Unable to connect to device even device has its own web server and I can ping its IP from my laptop.

capture

The code i am using is

<?php
require 'tad/lib/TADFactory.php';
require 'tad/lib/TAD.php';
require 'tad/lib/TADResponse.php';
require 'tad/lib/Providers/TADSoap.php';
require 'tad/lib/Providers/TADZKLib.php';
require 'tad/lib/Exceptions/ConnectionError.php';
require 'tad/lib/Exceptions/FilterArgumentError.php';
require 'tad/lib/Exceptions/UnrecognizedArgument.php';
require 'tad/lib/Exceptions/UnrecognizedCommand.php';

use TADPHP\TADFactory;
use TADPHP\TAD;

$options = [
    'ip' => '192.168.10.90',   // '169.254.0.1' by default (totally useless!!!).
    'udp_port' => 4370,      // 4370 by default.
  ];

$tad_factory = new TADFactory($options);
$tad = $tad_factory->get_instance();
$logs = $tad->is_alive();
var_dump($logs);die();

?>

also tried different functions other than $tad->is_alive() but not working at all. When I use $tad->get_att_log(); i get error

Fatal error: Uncaught TADPHP\Exceptions\ConnectionError: Imposible iniciar conexión con dispositivo 192.168.10.90 in C:\xampp\htdocs\projects\tx628\tad\lib\TAD.php:408 Stack trace: #0 C:\xampp\htdocs\projects\tx628\tad\lib\TAD.php(271): TADPHP\TAD->check_for_connection() #1 C:\xampp\htdocs\projects\tx628\test.php(23): TADPHP\TAD->__call('get_att_log', Array) #2 {main} thrown in C:\xampp\htdocs\projects\tx628\tad\lib\TAD.php on line 408

Can you please tell what is the issue with it? One thing also to share is this device was working properly with ZK_Lib.

cobisja commented 7 years ago

Hi,

Can you double check your device has a web server with SOAP support? ... If you say Zk_lib it's working properly, that is because uses UDP protocol for communication, but TAD uses SOAP. So, I think your device's web server had not SOAP support or maybe it is not configured properly

Best regards,

El 09/09/2017 04:09, "salmansidd17" notifications@github.com escribió:

Unable to connect to device even device has its own web server and I can ping its IP from my laptop.

[image: capture] https://user-images.githubusercontent.com/31650139/30238350-2bc6c0ce-955f-11e7-8e1b-9b2d46e9d3c0.PNG

The code i am using is

`<?php require 'tad/lib/TADFactory.php'; require 'tad/lib/TAD.php'; require 'tad/lib/TADResponse.php'; require 'tad/lib/Providers/TADSoap.php'; require 'tad/lib/Providers/TADZKLib.php'; require 'tad/lib/Exceptions/ConnectionError.php'; require 'tad/lib/Exceptions/FilterArgumentError.php'; require 'tad/lib/Exceptions/UnrecognizedArgument.php'; require 'tad/lib/Exceptions/UnrecognizedCommand.php';

use TADPHP\TADFactory; use TADPHP\TAD;

$options = [ 'ip' => '192.168.10.90', // '169.254.0.1' by default (totally useless!!!). 'udp_port' => 4370, // 4370 by default. ];

$tad_factory = new TADFactory($options); $tad = $tad_factory->get_instance(); $logs = $tad->is_alive(); var_dump('

',$logs);die();

?>`

also tried different functions other than $tad->is_alive() but not working at all. When I use $tad->get_att_log(); i get error

Fatal error: Uncaught TADPHP\Exceptions\ConnectionError: Imposible iniciar conexión con dispositivo 192.168.10.90 in C:\xampp\htdocs\projects\tx628\tad\lib\TAD.php:408 Stack trace: #0 C:\xampp\htdocs\projects\tx628\tad\lib\TAD.php(271): TADPHP\TAD->check_for_connection() #1 C:\xampp\htdocs\projects\tx628\test.php(23): TADPHP\TAD->__call('get_att_log', Array) #2 {main} thrown in C:\xampp\htdocs\projects\tx628\tad\lib\TAD.php on line 408

Can you please tell what is the issue with it? One thing also to share is this device was working properly with ZK_Lib https://github.com/dnaextrim/php_zklib.

— 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/35, or mute the thread https://github.com/notifications/unsubscribe-auth/AJzLMvNTuUns32bZc-B_BIDUyOMcB2Efks5sgkefgaJpZM4PR7FT .

salmansidd17 commented 7 years ago

I think my device only supports UDP. I was facing some bugs in ZK_lib that's why switched to yours but that also didn't work for me.So I made changes in ZK_lib myself and got it to work fine for me.

Thank you for your response by the way. :)

haseebhk22 commented 6 years ago

i have the same issue with my device can you explain what changes do you made in Zk_lib?

haseebhk22 commented 6 years ago

@salmansidd17 ??

salmansiddiqui17 commented 6 years ago

@haseebhk22 in zklib/zklib.php line no: 114 change if ($command == CMD_ACK_OK) to if ($command == CMD_ACK_OK || $command==2005)

haseebhk22 commented 6 years ago

@salmansidd17 I have change this code but there show nothing empty table my device is ZKTecho mb160 can you help me how to make connection and get data ?

haseebhk22 commented 6 years ago

@salmansidd17 And can you tell me how do i know that my device is udp supported or not and how to check firmware version and all this

salmansiddiqui17 commented 6 years ago

@haseebhk22 do you have any attendance data in your device?

haseebhk22 commented 6 years ago

@salmansidd17 Yes i have and i can access it from the software which is provided by the company in a cd disk

salmansiddiqui17 commented 6 years ago

@haseebhk22 i had zk tx628. That tweak worked for me that time. I think they had changed their firmware so the older library doesn't works anymore.

haseebhk22 commented 6 years ago

@salmansidd17 so you can't help me in this if you have anything know about it please let me now me

azizcreativitykw commented 2 years ago

@haseebhk22 in zklib/zklib.php line no: 114 change if ($command == CMD_ACK_OK) to if ($command == CMD_ACK_OK || $command==2005)

working as expected