Art-of-WiFi / UniFi-API-client

A PHP API client class to interact with Ubiquiti's UniFi Controller API
MIT License
1.09k stars 217 forks source link

stat_monthly_user on cloud key v2 fails with self-signed certificate curl error #157

Closed jwatte closed 1 year ago

jwatte commented 2 years ago

I'm using a UnifiOS device, the cloud key v2 pro, and talking to it using localhost (installing/running PHP on the device itself.) Many test scripts work fine.

I'm trying the list_connected_users.php example script, and it does not work -- I get PHP CURL errors about self signed certificates. Surprisingly, I have not turned on SSL verify, and I even add turning-off code right before the call, but it still fails:

$unifi_connection->set_curl_ssl_verify_peer(false);
$unifi_connection->set_curl_ssl_verify_host(false);

I get these errors:

root@Office-CloudKey-v2:/usr/local/src/observe-integration# php list_user_stats.php
PHP Notice:  cURL error: SSL certificate problem: self signed certificate in /usr/local/src/observe-integration/UniFi-API-client/src/Client.php on line 155
PHP Notice:  cURL error: SSL certificate problem: self signed certificate in /usr/local/src/observe-integration/UniFi-API-client/src/Client.php on line 189

and no output. Sdding the CURLOPT_SSL_VERIFYHOST => false and CURLOPT_SSL_VERIFYPEER => false inline to the options on line 143, I get errors on future calls instead. What's re-setting these options?

malle-pietje commented 2 years ago

Hmm, I’m unable to reproduce that. Can you please share the following:

malle-pietje commented 2 years ago

Can you also let us know which port you are using in the URL that points to the CK?

malle-pietje commented 1 year ago

Closing due to lack of feedback.