-
Notifications
You must be signed in to change notification settings - Fork 152
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.13, API client class version 1.1.2
- API browser tool: removed HighLight.js and replaced with jQuery JSONView - API browser tool: added version check to About Modal - API client class: added functions locate_ap() and site_leds(), replacing site_ledson()/site_ledsoff() and unset_locate_ap()/set_locate_ap(). The old functions remain usable through aliases. - API client class: minor code cleanup - API client class: added basic usage example to README.md - examples: added list_social_auth_details.php example
- Loading branch information
1 parent
0926697
commit 9125e45
Showing
5 changed files
with
286 additions
and
112 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
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,42 @@ | ||
<?php | ||
/** | ||
* PHP API usage example | ||
* | ||
* contributed by: slooffmaster | ||
* description: example basic PHP script to pull Facebook social auth details from the UniFi controller and output | ||
* them in basic HTML format | ||
*/ | ||
|
||
/** | ||
* include the config file (place you 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 site to use | ||
*/ | ||
$site_id = '<enter your site id here>'; | ||
|
||
/** | ||
* load the Unifi API connection class and log in to the controller and do our thing | ||
*/ | ||
require_once('../phpapi/class.unifi.php'); | ||
$unifidata = new unifiapi($controlleruser, $controllerpassword, $controllerurl, $site_id, $controllerversion); | ||
$loginresults = $unifidata->login(); | ||
$data = $unifidata->stat_payment(); | ||
|
||
/** | ||
* cycle through the results and print social auth details if set, | ||
* at this stage you can choose to do with the payment objects whatever is needed | ||
*/ | ||
echo 'Results from Facebook social auth:<br>'; | ||
foreach ($data as $payment) { | ||
if (isset($payment->gateway) && $payment->gateway == 'facebook') { | ||
echo 'First name: ' . $payment->first_name . ' Last name: ' . $payment->last_name . ' E-mail address: ' . $payment->email . '<br>'; | ||
} | ||
} | ||
|
||
echo '<hr><br>'; |
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
Oops, something went wrong.