Art-of-WiFi / UniFi-API-browser

Tool to browse data exposed by Ubiquiti's UniFi Controller API
MIT License
1.1k stars 150 forks source link

Problem after git clone #64

Closed danielwerner-dev closed 5 years ago

danielwerner-dev commented 5 years ago

Hello guys, i cloned the project to /var/www/html, created the config.php with credentials and when im accessing it from web. i get this error:

Parse error: syntax error, unexpected '[' in /var/www/html/UniFi-API-browser/index.php on line 48

danielwerner-dev commented 5 years ago

My PHP version is 5.3.3, so empty arrays must be declared as array(), instead of []

malle-pietje commented 5 years ago

Thanks for the feedback. Indeed, that’s why 5.6 is the minimum requirement, maybe I need to make that requirement more explicit in the README.

danielwerner-dev commented 5 years ago

You dont need to be rude, i changed the sintax and that problem was solved. Now, if you can help, i cant log into the interface, that is the error:

No sites available This is probably caused by incorrect access rights in the UniFi controller, or the controller is not accepting connections. Please check your credentials and/or your server error logs and try again.

Controller: 5.7.23 Controller user: super admin role

I can log into controller with the same credentials, but not with ur browser API.

malle-pietje commented 5 years ago

After such a post you are on your own: my message wasn’t rude, just stating facts. Good luck!

danielwerner-dev commented 5 years ago

Words are not well interpreted as conversations, my apologies if i was rude. I dont have any idea of what is happening with the loggin problem

May i ask your help. Working i can send you the project, as a fork to php 5.3.3

malle-pietje commented 5 years ago

Ok, understood. If you wish to maintain a fork that supports 5.3.3 feel free to reference that fork here in case others have the same requirement. We do not plan to support 5.3.3 because its EOS date has expired 4-5 years ago. We prefer to spend our available efforts on new functionality.

Why you cannot login is difficult to say, in most cases this is caused by incorrect settings in the config file. To troubleshoot this you can best enable debug mode in the config file which will display a lot of useful information when connecting to the controller in the various stages.

danielwerner-dev commented 5 years ago

Here is the debug: https://pastebin.com/x4b3iq1u

Login URL: https://10.10.3.17:8443/manage/account/login

malle-pietje commented 5 years ago

What is the value you entered for $controllerpassword in the config file? It looks as if you added some characters after the port number (which should not be needed).

danielwerner-dev commented 5 years ago

Hi, here is the full file: https://pastebin.com/xTAix0ni

The same user/password is ok when i log using the url directly on browser :)

malle-pietje commented 5 years ago

I actually meant the value for $controllerurl, but in your pastebin it looks fine. I suspect your changes have had some side effects.

danielwerner-dev commented 5 years ago

Hi again,

Thx for your feedback. I just changed the array declarations like: [ ] for array() json_encode(['username' => $this->user, 'password' => $this->password])) to json_encode("{'username' => $this->user, 'password' => $this->password}"))

The Client.php changed is here: https://pastebin.com/ckzHnzmt

Ps.: Im going to airport now, on monday i'll look at this again, otherwise i'll loose my flight. Can we keep in touch ?

malle-pietje commented 5 years ago

Hope you had a good flight. If you want to use the old array() function your example should look like this instead:

json_encode(array('username' => $this->user, 'password' => $this->password))