I need to create an ejabberd user from a PHP script. I also need to be able to add the new user to a predefined shared roster.
Should I just call ejabberdctl<
The easiest way of doing this is using mod_xmlrpc - which allows you to run the ejabberdctl commands using xmlrpc. This is easy to use with a library such as:
https://github.com/gamenet/php-jabber-rpc
/* Add user to Jabber */
use \GameNet\Jabber\RpcClient;
use \GameNet\Jabber\Mixins\UserTrait;
$rpc = new RpcClient([
'server' => 'jabber.org:4560',
'host' => 'myhost.org',
'debug' => false,
]);
$result=$rpc->createUser( $username, $password );