Update zabbix.rpc.php
This commit is contained in:
parent
e974610602
commit
025f22d7f1
|
|
@ -1,3 +1,34 @@
|
|||
<?php
|
||||
// @file zabbix.rpc.php
|
||||
|
||||
if(!check_function_exists("zabbix_get_base_url")) {
|
||||
function zabbix_get_base_url() {
|
||||
return "http://localhost";
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("zabbix_authenticate")) {
|
||||
function zabbix_authenticate($username, $password) {
|
||||
$response = false;
|
||||
|
||||
if(loadHelper("webpagetool")) {
|
||||
$response = get_web_json(zabbix_get_base_url() . "/zabbix/api_jsonrpc.php", "post", array(
|
||||
"headers" => array(
|
||||
"Content-Type" => "application/json-rpc",
|
||||
),
|
||||
"data" => array(
|
||||
"jsonrpc" => "2.0",
|
||||
"method" => "user.login",
|
||||
"params" => array(
|
||||
"user" => $username,
|
||||
"password" => $password,
|
||||
),
|
||||
"id" => 1,
|
||||
"auth" => null,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user