Create ejabberd user from PHP

后端 未结 7 1669
说谎
说谎 2020-12-08 17:37

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<

相关标签:
7条回答
  • 2020-12-08 18:21

    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 );
    
    0 讨论(0)
提交回复
热议问题