ejabberd - Create user in ejabbred using PHP


Right now I am trying to create a user in ejabberd using PHP. I have checked many sources From Git. As well as I tried to follow the same answer as given in this question

But sometimes user is going to be created, and sometimes not, so any debug points.


As per my knowledge there is issue related to time limit between create user one after another in ejabberd.

For example : My script is going to run and create a user at a time.

Then I have to wait around 8-9 minutes, then I am try executing my script then it will create another user for me on first try but IF I try to create another user just after some time. Is that possible?


require 'vendor/autoload.php';

use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Fabiang\Xmpp\Options;
use Fabiang\Xmpp\Client;
use Fabiang\Xmpp\Protocol\Register;
use Fabiang\Xmpp\Protocol\Roster;
use Fabiang\Xmpp\Protocol\Presence;
use Fabiang\Xmpp\Protocol\Message;
$logger = new Logger('xmpp');
$logger->pushHandler(new StreamHandler('php://stdout', Logger::DEBUG));

 $hostname      ='';
 $port           = 5222;
 $connectionType = 'tcp';
 $address        = "$connectionType://$hostname:$port";
 $adminUsername ="admin";
 $adminPassword = "admin";

 $name ="87878";
 $name ="87890";
 $password = "maddy";

 $options = new Options($address);
        ->setContextOptions(['ssl' => ['verify_peer' => false,'verify_peer_name' => false]]);
 $client = new Client($options);         

 $register = new Register($name, $password);                

Any suggestions?

People are also looking for solutions to the problem: php - CodeIgniter 3.1.0 form validation issue


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.