How to create XMPP(ejabberd) users using XMPPHP client

702 Views Asked by At

I have created the connection and sent messages using following code,

include("XMPPHP/XMPP.php");
$conn = new XMPPHP_XMPP(
    '192.168.1.204',
    5222,
    'eshin(username)',
    'eshin(password)',
    'xmpphp',
    '192.168.1.204'
);

//$conn->use_encryption = false; // Optional
$conn->connect();
$conn->processUntil('session_start');
$conn->message('[email protected]', 'Hai anas!');
$conn->disconnect();

Now I need to create XMPP users via xmpphp client... Kindly help me ..

1

There are 1 best solutions below

0
Mickaël Rémond On

You should use ejabberdctl register command to create a user. You can also use the same register command exposed through ReST API: https://docs.ejabberd.im/admin/api/#register---register-a-user