2017-04-26 23 views
1

のモバイル無線LAN接続を切断し、私はのUniFiコントローラ(v5.4.11)の外部キャプティブポータルと、このライブラリを使用して成功した認可デバイス作成しました:とき私、しかしのUniFi外部キャプティブポータル - 認証

https://github.com/malle-pietje/UniFi-API-browser

をPHPコードがauthorize_guest($ mac、$ duration)コマンドを送信すると、問題のモバイルデバイスの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; 

答えて

0

レポの作成者が私に答えました。数行は不必要でした。作業コードは次のようになります。

$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; 
関連する問題