Engineering notes

ZKTeco ADMS Integration Using PHP: A Practical Guide

By Taha Rafi · 2026-11-24 · 8 min read

ZKTeco ADMS Integration Using PHP: A Practical Guide

Polling a ZKTeco device over TCP/UDP works when it has a stable, reachable IP — on a LAN, or port-forwarded through a static WAN address. It falls apart the moment a device is behind a 4G router, CGNAT, or a site network you don't control. ZKTeco's answer to that is ADMS (also called iClock Cloud): the device initiates the connection outbound to your server instead of the other way around.

How ADMS actually works

Point the device's Cloud Server (ADMS) setting at your PHP endpoint. From then on, the device itself periodically sends HTTP GET and POST requests to it:

Nothing here requires your server to reach the device at all — only the reverse, which works through any ordinary outbound internet connection.

A minimal ADMS endpoint in PHP

AdmsServer in php-zkteco implements this protocol (request parsing, response format, and a command queue) so the endpoint itself stays small:

use TahaRafi\ZKTeco\AdmsServer;
use TahaRafi\ZKTeco\WebhookDispatcher;

$webhooks = (new WebhookDispatcher())->addEndpoint(
    'https://your-app.com/webhooks/zkteco',
    'whsec_secret',
);
$adms = new AdmsServer($webhooks, __DIR__ . '/.adms_queue.json', timezoneOffset: 5);

$adms->onAttendance(function (string $serialNumber, array $records): void {
    // $records: the device just POSTed real attendance rows — persist them here.
});

// Queue a command for the device to pick up on its next /iclock/getrequest poll:
// $adms->queueUnlockDoor('SERIAL123');

$response = $adms->handleRequest();
http_response_code($response['status']);
echo $response['body'];

In a Laravel app, this is a single route (e.g. Route::any('/iclock/{path}', ...)) handing off to the same logic — kept outside normal CSRF/session middleware, since the device is not a browser.

Pairing ADMS with signed webhooks

Receiving the raw attendance POST is only half the problem — your application still needs to react to it (update a dashboard, notify a service, trigger payroll processing) without tightly coupling that logic to the ADMS endpoint itself. Dispatching an HMAC-SHA256 signed webhook from inside onAttendance() keeps the two concerns separate, and lets the receiving side verify the payload genuinely came from your ADMS server:

use TahaRafi\ZKTeco\WebhookDispatcher;

// On the receiving endpoint:
$event = WebhookDispatcher::captureIncoming('whsec_your_secret_key');

if ($event['event'] === WebhookDispatcher::EVENT_ATTENDANCE_PUNCH) {
    $punch = $event['data'];
    // $punch['user_id'], $punch['state_label'], $punch['timestamp']
}
http_response_code(200);

When to choose ADMS over direct socket polling

If the device is reachable on a stable LAN or static IP, direct TCP/UDP polling (covered in the companion article on integrating ZKTeco with Laravel) is simpler and gives you on-demand pulls. ADMS is the right call specifically when the device is behind NAT, a 4G/LTE router, or a network where opening an inbound port isn't realistic — which, in practice, is most multi-site deployments with terminals outside a single controlled office network.

Related services

Related case studies

Device stuck behind a 4G router or no port forwarding?

Share your requirements and we'll discuss a practical scope, approach, and next steps.

All articles