API For ZTE MF284 4G Router, possible for related types as well
composer require christianberkman/zte-mf286-api
<?php
$zteApi = new ZTEMF286\Api('192.168.1.1', '/path/to/cookie');
$login = $zteApi->login('password'); // returns boolean
- constructor
- setCookiePath
- login
- getCMd
- setCMd
- isWanConnected
- connect
- reconnect
- restart
- dataUsage
- realtime
- connectedDevices
Construct the class and set the router's IP, optional cookie path
Checks if the path is writeable and sets the cookie path if true. Cookie filename is zte-cookie
.
Login to the router using provided password, returns boolean.
Return parameters given in $commands
(see (get-commands.md)[https://github.com/christianberkman/zte-mf286-api/blob/main/get-commands.md]) as array
Set $decode
to true to decode json response into an array, false to return the response as a string. Returns null if failed.
Post $command
including $postFields
.
Set $decode
to true to decode json response into an array, false to return the response as a string. Returns null if failed.
Returns if WAN is connected, returns boolean
Attempt to connect the network, returns boolean
Attempt to disconnect, returns boolean
Attempt to restart the router, returns boolean
Report the datausage as an array, returns false if failed
[rx] => Array
[bytes] => 116867051568
[GiB] => 108.84
[tx] => Array
[bytes] => 17771215964
[GiB] => 16.55
[total] => Array
[bytes] => 134638267532
[GiB] => 125.39
Return realtime rx and tx bytes/s, KiB/s, MiB/s. Often 0 is returned as is the upload/download monitor in the modem's interface
[rx_mib] => 0
[rx_kib] => 0.34
[rx_bytes] => 348
[tx_mib] => 0
[tx_kib] => 0.18
[tx_bytes] => 188
Return an array of connected devices
[wifi]
[0]
[mac_addr] => 1C:F2:9A:56:09:73
[hostname] => Google-Nest-Mini
[ip_addr] => 192.168.1.161
[addr_type] => 2
[ssid_index] => 0
[..]
[lan]
[..]
[all]
[..] // wifi and lan combined