public function get_Qumulo_Details($IPv4Addr, $Username, $Password)
{
$QM_Session_Key = '';
$QM_Session_Key = get_session_key($IPv4Addr,$Username, $Password);
$QM_Response = Get_Qumulo_Details($IPv4Addr, $QM_Session_Key, 'GET', '/v1/file-system');
return $QM_Response;
}// END get_Qumulo_Details
public static function get_session_key($ipaddr,$uname, $pword) {
$Session_Key = '';
$data = '{"username": "' . $uname . '", "password": "' . $pword . '"}';
$Data_Len = strlen($data);
$wsapi_url = 'https://' . $ipaddr . ':8000/v1/session/login';
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$wsapi_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, Array('POST /v1/session/login HTTP/1.1 -H'));
curl_setopt($ch, CURLOPT_HTTPHEADER, Array('Content-Length: ' . $Data_Len));
curl_setopt($ch, CURLOPT_HTTPHEADER, Array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); //FALSE outputs the responce to the page - TRUE outputs responce to as string
curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
$response = curl_exec($ch);
curl_close($ch);
// echo var_dump($response);
$response = json_decode($response,true);
foreach ($response as $key => $value)
{
$Session_Key = $value;
}
return $Session_Key;
}// END get_session_key
public function Get_Qumulo_Details($IPv4Addr, $Session_Key, $TYPE, $API_Dir)
{
$wsapi_url = 'https://' . $IPv4Addr . ':8000' . $API_Dir;
$data = 'Authorization: Bearer ' . $Session_Key;
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$wsapi_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, Array($TYPE . ' ' . $API_Dir . ' HTTP/1.1 -H'));
curl_setopt($ch, CURLOPT_HTTPHEADER, Array($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); //FALSE outputs the responce to the page - TRUE outputs responce to as string
curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
$response = curl_exec($ch);
curl_close($ch);
// echo var_dump($response);
$response = json_decode($response,true);
return $response;
}