send zmcCommand to api on server

This commit is contained in:
Isaac Connor 2016-06-07 14:39:59 -04:00
parent b2dfdea66e
commit 086d435712
1 changed files with 18 additions and 0 deletions

View File

@ -835,6 +835,24 @@ function zmcControl( $monitor, $mode=false ) {
} }
daemonControl( "start", "zmc", $zmcArgs ); 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 */ }
} }
} }