So first out -> Im fairly new to connect to API via curl and php. I've been trying for Days to actually figure out how to just get the number of total connected wifi-clients to our Ruckus-network. I've been trying lots of stuff but with poor results.
Here's what i've got atm:
$curl2 = curl_init();
curl_setopt_array($curl2, array(
CURLOPT_URL => "
https://10.98.0.6:8443/wsg/api/public/v6_1/aps//operational/client/totalCount";,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache"
),
));
$response2 = curl_exec($curl2);
$err2 = curl_error($curl2);
if ($err2) {
echo "cURL Error #:" . $err2;
} else {
$response2 = json_decode(json_encode($response2), true);
echo $response2;
}
curl_close($curl2);
So this code generates "{"message":"Current session has timed out.","errorCode":201,"errorType":"No active session"}". My guess is that I need to make a similar login-script and get some sort of session-cookie? And for this i'm lost. I've tried a couple of things but without any results. The code down below for logon returns, as far as I can see, nothing.
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_PORT => "8443",
CURLOPT_URL => "
https://10.98.0.6:8443/wsg/api/public/v6_1/session";,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\r\n \"username\": \"\",\r\n \"password\": \"\",\r\n \"timeZoneUtcOffset\": \"+01:00\"\r\n}",
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"content-type: application/json;charset=UTF-8",
"cookie: JSESSIONID={JSESSIONID}",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
Is there some Beautiful human being that can help me with this. This isnt my main area of expertise, I simply just want to show total amount of clients connected to our wifi in a dashboard.
Cheers!