|
1 | 1 | <?php |
2 | 2 | /** |
3 | | - * Copyright (c) 2021, Art of WiFi |
| 3 | + * Copyright (c) 2023, Art of WiFi |
4 | 4 | * www.artofwifi.net |
5 | 5 | * |
6 | 6 | * This file is subject to the MIT license that is bundled |
|
16 | 16 | require_once '../collections.php'; |
17 | 17 | require_once '../vendor/autoload.php'; |
18 | 18 |
|
| 19 | +use UniFi_API\Client as ApiClient; |
| 20 | + |
19 | 21 | /** |
20 | 22 | * load the configuration file if readable |
21 | 23 | */ |
|
124 | 126 | /** |
125 | 127 | * create an instance of the Unifi API client class, log in to the controller and pull the requested data |
126 | 128 | */ |
127 | | - $unifi_connection = new UniFi_API\Client(trim($controller['user']), trim($controller['password']), |
128 | | - trim(rtrim($controller['url'], "/")), $site_id); |
129 | | - $loginresults = $unifi_connection->login(); |
| 129 | + $unifi_connection = new ApiClient( |
| 130 | + trim($controller['user']), |
| 131 | + trim($controller['password']), |
| 132 | + trim(rtrim($controller['url'], "/")), |
| 133 | + $site_id |
| 134 | + ); |
| 135 | + |
| 136 | + $login_results = $unifi_connection->login(); |
130 | 137 |
|
131 | 138 | /** |
132 | 139 | * check for login errors |
133 | 140 | */ |
134 | | - if ($loginresults === 400) { |
| 141 | + if ($login_results === 400) { |
135 | 142 | $results['state'] = 'error'; |
136 | 143 | $results['message'] = 'UniFi controller login failure, please check your credentials in config/config.php!'; |
137 | 144 | } else { |
|
0 commit comments