Works fine!
Thanks Domi!
Thanks Domi!
$host = $api->hostCreate(array(
'host' => 'HOSTNAME',
'interfaces' => array(
array(
'type' => 1,
'main' => 1,
'useip'=> 1,
'ip' => '10.0.254.254',
'dns' => '',
'port' => 10050,
),
array(
'type' => 2,
'main' => 1,
'useip'=> 1,
'ip' => '10.0.254.254',
'dns' => '',
'port' => 161,
),
),
'groups' => array(
array('groupid' => 6),
),
));
<?php
// load ZabbixApi
#require 'ZabbixApiAbstract.class.php';
require 'ZabbixApi.class.php';
try {
// create new ZabbixApi instance
$api = new ZabbixApi;
// set API url
$api->setApiUrl('https://zabbix.shotspotter.com/api_jsonrpc.php');
// try to login into Zabbix API
$api->userLogin(array('user' => 'zabbixapi', 'password' => 'zabbixapi'));
} catch(Exception $e) {
// Exception in ZabbixApi catched
echo $e->getMessage();
}
?>
PHP Warning: fopen(https://myserver.mydomain.com/api_jsonrpc.php): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /usr/share/PhpZabbixApi_Builder/build/ZabbixApiAbstract.class.php on line 234 Could not connect to "https://myserver.mydomain.com/api_jsonrpc.php"
I have successfully used the Ruby bindings for the API, but now I need to use PHP for this project. Any help would be appreciated, I am running Zabbix version 2.2 on vanilla CentOS linux box. It is also worth mentioning that I am running this via the command line, not in a web browser.
Comment