UNIFI外部圈养门户 - 移动WiFi在AUTH上断开连接



我在Unifi控制器(v5.4.11(上创建了一个外部圈养门户,并使用此库成功授权设备:

https://github.com/malle-pietje/unifi-api-browser

但是,当我的php代码发送授权_guest($ mac,$ disration(命令时,实际上已断开了有关移动设备的WiFi。

据我所知,这都发生在Android和iOS上。

这是我正在使用的代码:

 $controlleruser = $CFG->unifi_user;
$controllerpassword = $CFG->unifi_pass;
$controllerurl = 'https://'.$server.':'.$CFG->unifi_port;
$controllerversion = '5.4.11';
$cookietimeout = '3600';
$theme = 'bootstrap';
$debug = false;
$duration = $CFG->unifi_minutes;
$note = '';
$site_id = 'default';
require_once('class.unifi.php');
$unifidata      = new unifiapi($controlleruser, $controllerpassword, $controllerurl, $site_id, $controllerversion);
$set_debug_mode = $unifidata->set_debug($debug);
$loginresults   = $unifidata->login();
/**
 * To add note to a new device we need to do the following before authorizing the device:
 * - first block the device to get an entry in the user collection
 * - get the device id from the user collection
 * - add note to the device
 * - then unblock the device again
 */
$block_result   = $unifidata->block_sta($mac);
$getid_result   = $unifidata->stat_client($mac);
$user_id        = $getid_result[0]->_id;
$note_result    = $unifidata->set_sta_note($user_id, $note);
$unblock_result = $unifidata->unblock_sta($mac);
/**
 * then we authorize the device for the requested duration
 */
$auth_result = $unifidata->authorize_guest($mac, $duration);
/**
 * provide feedback in json format
 */
return $auth_result;

回购的创建者对我做出了回应。几行是不必要的。工作代码看起来像这样:

$unifidata      = new unifiapi($controlleruser, $controllerpassword, $controllerurl, $site_id, $controllerversion);
$set_debug_mode = $unifidata->set_debug($debug);
$loginresults   = $unifidata->login();
$auth_result = $unifidata->authorize_guest($mac, $duration);
return $auth_result;

相关内容

  • 没有找到相关文章

最新更新