Art-of-WiFi / UniFi-API-client

A PHP API client class to interact with Ubiquiti's UniFi Controller API
MIT License
1.13k stars 223 forks source link

api hanging after mid December #144

Closed zx5000 closed 2 years ago

zx5000 commented 2 years ago

This code has been working for over a year but now it has stopped. Nothing has been updated unifi version 6.5.54 Client.php version 1.1.57

Here's the message. [Wed Jan 26 16:13:00.711131 2022] [php7:notice] [pid 5493] [client 99.58.251.118:50855] PHP Notice: cURL error: Empty reply from server in /home/pi/unify/vendor/art-of-wifi/unifi-api-client/src/Client.php on line 151

Code snippets: require_once('vendor/autoload.php');

$voucher_result = $unifi_connection->create_voucher($voucher_expiration, $voucher_count, 0, $transaction); $vouchers = $unifi_connection->stat_voucher($voucher_result[0]->create_time); for($x=0; $x<$voucher_count; $x++) { $voucher=substr($vouchers[$x]->code,0,5)."-".substr($vouchers[$x]->code,5,5); $db->exec("insert into log (tx_id, voucher) values ('".$transaction."','".$voucher."')"); }

malle-pietje commented 2 years ago

This perhaps a UniFi OS Console running firmware 1.11.0? Update to the latest version of the client and you should be fine.

zx5000 commented 2 years ago

Awesome. That did it. Dream machine must have updated.