ZKLibrary
ZKLibrary copied to clipboard
can't connect to device
i'm trying connect to my device solution x105, but always show false
you cannot call connect() function 2 time in the same page, that will make problem if you want to dump the connection to test it call connect only in var_dump : use the following instrection
<?php
include_once "zklibrary.php";
$zk = new ZKLibrary('192.168.0.30', 4370, 'TCP');
// $zk->connect();
var_dump( $zk->connect());
exit;
?>
then if it work just uncomment // $zk->connect(); and comment the second :
<?php
include_once "zklibrary.php";
$zk = new ZKLibrary('192.168.0.30', 4370, 'TCP');
$zk->connect();
//var_dump( $zk->connect());
exit;
?>
I hope that can help you
how you identify the IP and port? can anyone give me example
i'm trying connect to my device solution x105, but always show false
I use the following method to see if I can connect to the fingerprint:
exec("ping " . $ip, $output, $result); if ($result == 0){ if(count(preg_grep('/Destination host unreachable/i', $output)) == 0){ echo "Ping successful!";
require 'zklibrary.php'; $zk = new ZKLibrary($ip, 4370); $zk->connect(); $zk->disableDevice(); $zk->enableDevice(); $zk->disconnect(); } else echo "Ping unsuccessful!";
} else echo "Ping unsuccessful!";
how you identify the IP and port? can anyone give me example
it's the Ip set in the fingerprint machine, I use Solution X105, I will go to menu >> comm settings >> Ethernet >> check IP Address
as for the port it will always use 4370. cmiiw