"GET", "endpoint" => "hosts", "timestamp" => time(), "parameters" => json_decode("{}") )); $response = json_decode(send_request($request), true); if (is_null($response)) { trigger_error("Error: Bogus response from server", E_USER_ERROR); } sort($response["hosts"]); return($response["hosts"]); } function ping_host($hostname) { $request = json_encode(array( "method" => "GET", "endpoint" => "ping", "timestamp" => time(), "parameters" => array( "host" => $hostname ) )); $response = json_decode(send_request($request), true); if (is_null($response)) { trigger_error("Error: Bogus response from server", E_USER_ERROR); } return $response["awake"]; } function wake_host($hostname) { $request = json_encode(array( "method" => "POST", "endpoint" => "wake", "timestamp" => time(), "parameters" => array( "host" => $hostname ) )); $response = json_decode(send_request($request), true); if (is_null($response) || (!$response["sent"])) { trigger_error("Error: Bogus response from server", E_USER_ERROR); } } ?>