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

Invalid Url Response #162

Closed julius-gitonga closed 1 year ago

julius-gitonga commented 2 years ago

I get this response when i make a call to the client

Notice: The URL provided is incomplete, invalid or ends with a / character! in /var/www/one/dev3/vendor/art-of-wifi/unifi-api-client/src/Client.php on line 3786

The url passed is in the format 'https://192.XXX.XX.XXX:8443'

malle-pietje commented 2 years ago

Please share the (sanitized) section of your code where you’re declaring the url and initiating the API client instance. Please also share your exact PHP version.

julius-gitonga commented 2 years ago

I am using Slim 3.0 running on PHP 5.6 //Declaration 'cloudkey'=>[ 'controlleruser'=>'', 'controllerpassword'=>'', 'controllerurl' => 'https://192.XXX.XX.XXX:8443', 'controllerversion'=>'6.5.55.0' ] //Request function

public function speedTest(Request $request, Response $response){

    $sid = $request->getParam('id');

    $school=$this->schoolService->fetchSchools($sid);
    $siteid= !empty($school->getSiteid()) ? $school->getSiteid() : 'default';

    $unifi_connection = new Client($this->cloudkey['controlleruser'], $this->cloudkey['controllerpassword'],    $this->cloudkey['controllerurl'], $siteid, $this->cloudkey['controllerversion'], false);
    return $response->withJson($unifi_connection->stat_speedtest_results());
}
malle-pietje commented 2 years ago

Looks fine to me. Please enable debug mode and share the sanitized output from that.

malle-pietje commented 1 year ago

Closing due to lack of feedback.