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?
<?php require 'vendor/autoload.php'; error_reporting(-1); 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 ='192.168.1.12'; $port = 5222; $connectionType = 'tcp'; $address = "$connectionType://$hostname:$port"; $adminUsername ="admin"; $adminPassword = "admin"; $name ="87878"; $name ="87890"; $password = "maddy"; $options = new Options($address); $options->setUsername($adminUsername) ->setPassword($adminPassword) ->setContextOptions(['ssl' => ['verify_peer' => false,'verify_peer_name' => false]]); $client = new Client($options); $client->connect(); $register = new Register($name, $password); $client->send($register); $client->disconnect(); ?>