Php OpenFire UserService, or POFUS, is a new self-built PHP implementation for OpenFire’s UserService plugin. It’s a fast and lightweight class having support for all the UserService functionality. More information and a download link can be found on Github by clicking here. Below is an example snippit on how to use the class.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
<?php
require_once ('lib/OpenFireUserService.php');
// Create the OpenFireUserService object.
$pofus = new OpenFireUserService();
// Set the required config parameters
$pofus->secret = "SuperSecret";
$pofus->host = "jabber.yourserver.com";
$pofus->port = "9090"; // default 9090
// Optional parameters (showing default values)
$pofus->useCurl = true;
$pofus->useSSL = false;
$pofus->plugin = "/plugins/userService/userservice"; // plugin folder location
// Add a new user to OpenFire and add him to a group
$result = $pofus->addUser('Username', 'Password', 'Real Name', 'email@email.tld', array('Group 1'));
// Check result if command is succesful
if($result) {
// Display result, and check if it's an error or correct response
echo ($result['result']) ? 'Success: ' : 'Error: ';
echo $result['message'];
} else {
// Something went wrong, probably connection issues
}
|
Github link: https://github.com/Cyerus/OpenFire-UserService-PHP-Class