用于PHP配置的Openfire RestAPI
我正在尝试使用RestAPI从连接到我的Openfire服务器 现在我已经在Openfire文件夹中安装了RestAPI插件。 我在Centos 7用于PHP配置的Openfire RestAPI,php,openfire,Php,Openfire,我正在尝试使用RestAPI从连接到我的Openfire服务器 现在我已经在Openfire文件夹中安装了RestAPI插件。 我在Centos 7 <?php include "vendor/autoload.php"; $api = new \Gnello\OpenFireRestAPI\API(); //Set the required config parameters $api->Settings()->setSecret("YWRtaW46YWRtaW
<?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");
在httpd日志中,它表示未定义的$result,这是显而易见的
但我遵循了存储库中提到的步骤
谁能告诉我怎么用这个吗
#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!';
}
OpenFireRESTAPI插件的Easy Php REST API客户端,该插件通过向服务器发送REST/HTTP请求来管理Openfire实例
有关使用此应用程序的更多信息,请阅读文档
安装
composer require gnello/php-openfire-restapi
$authenticationToken = new \Gnello\OpenFireRestAPI\AuthenticationToken('your_user', 'your_password');
认证
有两种验证方法:
基本HTTP身份验证
composer require gnello/php-openfire-restapi
$authenticationToken = new \Gnello\OpenFireRestAPI\AuthenticationToken('your_user', 'your_password');
共享密钥
$authenticationToken = new \Gnello\OpenFireRestAPI\AuthenticationToken('your_secret_key');
开始
$api = new \Gnello\OpenFireRestAPI\API('your_host', 9090, $authenticationToken);
用户
//Add a new user
$properties = array('key1' => 'value1', 'key2' => 'value2');
$result = $api->Users()->createUser('Username', 'Password', 'Full Name', 'email@domain.com', $properties);
//Delete a user
$result = $api->Users()->deleteUser('Username');
//Ban a user
$result = $api->Users()->lockoutUser('Username');
//Unban a user
$result = $api->Users()->unlockUser('Username');
然后打印结果。
打开更多链接。
OpenFireRESTAPI插件的Easy Php REST API客户端,该插件通过向服务器发送REST/HTTP请求来管理Openfire实例
有关使用此应用程序的更多信息,请阅读文档
安装
composer require gnello/php-openfire-restapi
$authenticationToken = new \Gnello\OpenFireRestAPI\AuthenticationToken('your_user', 'your_password');
认证
有两种验证方法:
基本HTTP身份验证
composer require gnello/php-openfire-restapi
$authenticationToken = new \Gnello\OpenFireRestAPI\AuthenticationToken('your_user', 'your_password');
共享密钥
$authenticationToken = new \Gnello\OpenFireRestAPI\AuthenticationToken('your_secret_key');
开始
$api = new \Gnello\OpenFireRestAPI\API('your_host', 9090, $authenticationToken);
用户
//Add a new user
$properties = array('key1' => 'value1', 'key2' => 'value2');
$result = $api->Users()->createUser('Username', 'Password', 'Full Name', 'email@domain.com', $properties);
//Delete a user
$result = $api->Users()->deleteUser('Username');
//Ban a user
$result = $api->Users()->lockoutUser('Username');
//Unban a user
$result = $api->Users()->unlockUser('Username');
然后打印结果。
打开更多链接。
在开发过程中,您可能需要访问一些有用的软件执行信息,这些信息通常不可用。为此,只需像这样启用调试模式//启用调试模式$api->Settings()->setDebug(true);我尝试启用调试模式,但没有效果:(它在屏幕@jyothi上没有显示任何内容。您必须执行任何操作,然后获得如下$results//添加一个新用户$properties=array('key1'=>'value1','key2'=>'value2');$result=$api->Users()->createUser('Username','Password','Full Name','email@domain.com“,$properties);如果($result)['response']{echo$result['output'];}else{echo'Error!';}simple$results=$api->getuser($username);然后现在检查($result['response']){echo$result['output'];}else{echo'Error!';}$results=$api->Settings()->setplugins(/plugins/restapi/v1”);f($result['response']){echo$result['output'];}else{echo'Error!';}在开发过程中,您可能需要访问一些有用的软件执行信息,这些信息通常不可用。为此,只需像这样启用调试模式//启用调试模式$api->Settings()->setDebug(true);我尝试了启用调试模式,但没有效果:(它不会在屏幕@jyothi上显示任何内容您必须执行任何操作,然后获得如下$results//添加新用户$properties=array('key1'=>'value1','key2'=>'value2');$result=$api->Users()->createUser('Username','Password','Full Name','email@domain.com“,$properties);如果($result['response']){echo$result['output'];}else{echo'Error!';}simple$results=$api->getuser($username);然后现在检查($result['response']){echo$result['output'];}else{echo'Error!';}$results=$api->Settings()->setPlugin(/plugins/restapi/v1”);f($result['response']){echo$result['output'];}else{echo'Error!'