From 971c77ab5f49cbd54d0eae169da84316011614de Mon Sep 17 00:00:00 2001 From: malle-pietje Date: Thu, 14 Sep 2017 12:15:21 +0200 Subject: [PATCH] various tweaks and an addition - more relaxed handling of $site in set_site(), now we only issue an error message when provided (short) site name is probably incorrect and debug mode is true - added test_connection.php, a command line script which can be used to quickly test the connection to your controller with various cURL options which you can quickly change --- README.md | 4 +-- examples/test_connection.php | 67 ++++++++++++++++++++++++++++++++++++ src/Client.php | 4 +-- 3 files changed, 70 insertions(+), 5 deletions(-) create mode 100755 examples/test_connection.php diff --git a/README.md b/README.md index 53e1602..e682434 100755 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ You can use **Composer**, **Git** or simply **Download the Release** The preferred method is via [composer](https://getcomposer.org). Follow the [installation instructions](https://getcomposer.org/doc/00-intro.md) if you do not already have composer installed. -Once composer is installed, simply execute this command from your project directory: +Once composer is installed, simply execute this command from the shell in your project directory: ```sh composer require art-of-wifi/unifi-api-client @@ -176,7 +176,7 @@ require_once('vendor/autoload.php'); */ $unifi_connection = new UniFi_API\Client($controller_user, $controller_password, $controller_url, $site_id, $controller_version); $login = $unifi_connection->login(); -$results = $unifi_connection->list_alarms(); // returns an PHP array containing alarm objects +$results = $unifi_connection->list_alarms(); // returns a PHP array containing alarm objects ``` Please refer to the `examples/` directory for some more detailed examples which you can use as a starting point for your own PHP code. diff --git a/examples/test_connection.php b/examples/test_connection.php new file mode 100755 index 0000000..98c878b --- /dev/null +++ b/examples/test_connection.php @@ -0,0 +1,67 @@ +debug) { error_log('The provided (short) site name is probably incorrect'); } $this->site = $site; - return $this->site; }