powered by Jive Software

Openfire RestAPI for PHP Configuration

I am trying to connect to my Openfire Server using RestAPI from Github

Now I have installed RestAPI plugin in Openfire folder. I am on Centos 7.

    <?php

include "vendor/autoload.php";

$api = new \Gnello\OpenFireRestAPI\API();

//Set the required config parameters
$api->Settings()->setSecret("YWRtaW46YWRtaW4");
$api->Settings()->setHost("localhost");
$api->Settings()->setServerName("localhost");

//Default values
$api->Settings()->setPort("9090");
$api->Settings()->setSSL(false);
$api->Settings()->setPlugin("/plugins/restapi/v1");

Now WhenI try to connect it shows error:

if($result['response']) {
    echo $result['output'];
} else {
    echo 'Error!';
}

In httpd logs it says undefined $result which is obvious.

But I followed the steps as it were mentioned on its repository.

Can Any One please guide me how to use this ?

#Udated

    include "vendor/autoload.php";

$api = new \Gnello\OpenFireRestAPI\API();

//Enable debug mode
$api->Settings()->setDebug(true);
$requests = \Gnello\OpenFireRestAPI\Debug\Request::getRequests();

//var_dump($api);

//var_dump($requests);

$result = $api->users();
//var_dump($api);

$username ="test2";
$results = $api->getuser($username); 


 if($result['response']) 
    { 
        echo $result['output']; 
    } 
else 
    { 
        echo 'Error!'; 
    }