send zmcCommand to api on server
This commit is contained in:
parent
b2dfdea66e
commit
086d435712
|
@ -835,6 +835,24 @@ function zmcControl( $monitor, $mode=false ) {
|
|||
}
|
||||
daemonControl( "start", "zmc", $zmcArgs );
|
||||
}
|
||||
} else {
|
||||
$Server = new Server( $monitor['ServerId'] );
|
||||
|
||||
$url = $Server->Url() . '/zm/api/monitors.json?auth='.generateAuthHash( $_SESSION['remoteAddr'] );
|
||||
$data = array('Monitor[Function]' => $monitor['Function'] );
|
||||
|
||||
// use key 'http' even if you send the request to https://...
|
||||
$options = array(
|
||||
'http' => array(
|
||||
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
||||
'method' => 'POST',
|
||||
'content' => http_build_query($data)
|
||||
)
|
||||
);
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($url, false, $context);
|
||||
if ($result === FALSE) { /* Handle error */ }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue