forked from Art-of-WiFi/UniFi-API-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API Browser version 1.0.15, API client class version 1.1.4
- API client class: added methods/functions upgrade_device(), upgrade_device_external(), spectrum_scan() and spectrum_scan_state() - API browser tool: embedded the favicon in base64 encoded format - API browser tool: added a dynamic "back to top" butoon - examples: added examples ap_scanning_state.php and auth_guest_basic.php
- Loading branch information
1 parent
8b4bcc2
commit 9cbcb60
Showing
9 changed files
with
209 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/** | ||
* PHP API usage example | ||
* | ||
* contributed by: slooffmaster | ||
* description: example basic PHP script to fetch an Access Point's scanning state/results | ||
*/ | ||
|
||
/** | ||
* include the config file (place your credentials etc. there if not already present) | ||
* | ||
* NOTE: | ||
* this example will only work out of the box with a single controller config file! | ||
*/ | ||
require_once('config-local.php'); | ||
|
||
/** | ||
* site id and MAC address of AP to query | ||
*/ | ||
$site_id = '<enter your site id here>'; | ||
$ap_mac = '<enter MAC address of Access Point to check>'; | ||
|
||
/** | ||
* load the Unifi API connection class and log in to the controller and do our thing | ||
* spectrum_scan_state() | ||
*/ | ||
require_once('phpapi/class.unifi.php'); | ||
$unifidata = new unifiapi($controlleruser, $controllerpassword, $controllerurl, $site_id, $controllerversion); | ||
$loginresults = $unifidata->login(); | ||
$data = $unifidata->spectrum_scan_state($ap_mac); | ||
|
||
/** | ||
* provide feedback in json format | ||
*/ | ||
echo json_encode($data, JSON_PRETTY_PRINT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/** | ||
* PHP API usage example | ||
* | ||
* contributed by: slooffmaster | ||
* description: example basic PHP script to perform a basic auth of a guest device | ||
*/ | ||
|
||
/** | ||
* include the config file (place your credentials etc. there if not already present) | ||
* | ||
* NOTE: | ||
* this example will only work out of the box with a single controller config file! | ||
*/ | ||
require_once('../config.php'); | ||
|
||
/** | ||
* the MAC address of the device to authorize | ||
*/ | ||
$mac = '<enter MAC address of guest device to auth>'; | ||
|
||
/** | ||
* the duration to authorize the device for in minutes | ||
*/ | ||
$duration = 2000; | ||
|
||
/** | ||
* The site to authorize the device with | ||
*/ | ||
$site_id = '<enter your site id here>'; | ||
|
||
/** | ||
* load the Unifi API connection class and log in to the controller | ||
*/ | ||
require_once('../phpapi/class.unifi.php'); | ||
$unifidata = new unifiapi($controlleruser, $controllerpassword, $controllerurl, $site_id, $controllerversion); | ||
$set_debug_mode = $unifidata->set_debug($debug); | ||
$loginresults = $unifidata->login(); | ||
|
||
/** | ||
* then we authorize the device for the requested duration | ||
*/ | ||
$auth_result = $unifidata->authorize_guest($mac, $duration); | ||
|
||
/** | ||
* provide feedback in json format | ||
*/ | ||
echo json_encode($auth_result, JSON_PRETTY_PRINT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters