0

The code I tried:

$address = '192.168.0.201';
$port = 4073;
$timeout = 30;

if (($socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) {
    exit("socket_create() failed: reason: " . socket_strerror(socket_last_error()));
}

$result = socket_connect($socket, $address, $port);

The socket is created successfully but socket_connect results with:

Warning: socket_connect(): unable to connect [10061]: No connection could be made because the target machine actively refused it in...

Device is on the same network and subnet, device and card reading works fine with the ZKAccess software..

I also tried existing library - https://github.com/mlrahman/ZKTeco_Attendance_Access_Using_PHP , but it produces identical error. Am I missing some steps or device configuration here?

John D
  • 11
  • 5

1 Answers1

0

ZKTeco devices have hardcoded TCP port 4370 but there is 4073 in your code. Try to change that, it might connect.

Despite that, this library doesn't seem to work with ZKTeco C3 devices, at least I was unable to make it work. There are several ZKTeco libraries for pythot that don't work, either. I've tried do trace the communication in Wireshark. After the communication is set, all libraries send the same 16 bit packet (5050827d08000000e80317fc00000000) which is ignored by the C3.

Unfortunately, it seems that the only way to communicate with C3 devices is to use the original ZKTeco SDK and to write a PHP wrapper around it.

Tomas Kuba
  • 26
  • 3