= 1<<30) || $unit == "GB") return number_format($size/(1<<30),2)." GB"; if( (!$unit && $size >= 1<<20) || $unit == "MB") return number_format($size/(1<<20),2)." MB"; if( (!$unit && $size >= 1<<10) || $unit == "KB") return number_format($size/(1<<10),2)." KB"; return number_format($size)." bytes"; } function post($action) { // Prepare the POST data // : $postfields["key"] = "YOUR API KEY"; $postfields["hash"] = "YOUR API HASH"; // This is the hostname of the master SolusVM server where you go to boot / reboot / configure / reinstall / get API keys for your VPS $masterurl = "https://master.vpshost.tld"; // $postfields["action"] = $action; $postfields["status"] = "true"; if($action == "info") { $postfields["hdd"] = "true"; $postfields["mem"] = "true"; $postfields["bw"] = "true"; } // Prepare the POST request $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "{$masterurl}/api/client/command.php"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Expect: ")); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // Execute the request $data = curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if($code != 200) { $return['error'] = 1; if($code == 405) { $return['message'] = "Incorrect API credentials."; return $return; } $return['message'] = "Invalid status code."; return $return; } // Close the Curl handle curl_close($ch); if(!$data) { $return['error'] = 1; $return['message'] = "Error connecting to API."; return $return; } // Extract the data preg_match_all('/<(.*?)>([^<]+)<\/\\1>/i', $data, $match); $result = array(); foreach ($match[1] as $x => $y) { $result[$y] = $match[2][$x]; } if($result['status'] == "error") { $return['error'] = 1; $return['message'] = $result['statusmsg']; return $return; } $return = $result; $return['error'] = 0; return $return; } if(isset($_GET['action'])) { $action = $_GET['action']; } else { $action = "info"; } switch($action) { case 'info': $result = post("info"); if($result['error'] == 0) { $return = $result; $return['hdd'] = explode(",", $return['hdd']); $return['mem'] = explode(",", $return['mem']); $return['bw'] = explode(",", $return['bw']); } else { $return = $result; } break; case 'reboot': $result = post("reboot"); if($result['error'] == 0) { $return = $result; $return['message'] = "Server rebooting now."; } else { $return = $result; } break; case 'boot': $result = post("boot"); if($result['error'] == 0) { $return = $result; $return['message'] = "Server booting now."; } else { $return = $result; } break; case 'shutdown': $result = post("shutdown"); if($result['error'] == 0) { $return = $result; $return['message'] = "Server shutting down now."; } else { $return = $result; } break; default: $return['error'] = 1; $return['message'] = "Invalid action specified."; } ?> SolusVM-Status

SolusVM-Status


Return to status page

Hostname

Status

IP Address

Hard Disk usage used of

%

RAM usage used of

%

Bandwith usage used of

%

Actions

Return to status page