Closed puneetxc closed 9 years ago
You're using the wrong port for RPC. Look at the example on readme.md
'server' => 'http://127.0.0.1:4560' El 14/04/2015 11:12, "puneetxc" notifications@github.com escribió:
I am using this $rpc = new \GameNet\Jabber\RpcClient([ 'server' => 'http://localhost:5222', 'host' => 'localhost', 'debug' => true, ]);
//Create 2 new users with name
Ivan
andPetr
with passwordsomeStrongPassword
$rpc->createUser('Ivan', 'someStrongPassword');I am getting this below error. What may be the issue?
Fatal error: Uncaught exception 'RuntimeException' with message 'Error execution command 'register'' with parameters array ( 'host' => 'localhost', 'user' => 'Ivan', 'password' => 'someStrongPassword', ). Response: <?xml version='1.0'?>stream:error/stream:error/stream:stream' in /var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/RpcClient.php:96 Stack trace: #0 /var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/Mixins/UserTrait.php(64): GameNet\Jabber\RpcClient->sendRequest('register', Array) #1 https://github.com/gamenet/php-jabber-rpc/issues/1 /var/www/first/vendor/aaa.php(10): GameNet\Jabber\RpcClient->createUser('Ivan', 'someStrongPassw...') #2 {main} thrown in /var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/RpcClient.php on line 96
— Reply to this email directly or view it on GitHub https://github.com/gamenet/php-jabber-rpc/issues/1.
My jabber is installed on 5222. I have tried above port also But still getting the same error.
When i visit the url "http://127.0.0.1:4560/", it shows no page avaliable as my jabber is listening on 5222
5222 is the default TCP port for XMPP client connections, for RCP usually is 4560 and you have to enable it on your jabber server. In my case (ejabberd) I had to uncomment a pair of lines in the modules section on ejabberd.yml config file to enable the RPC service.
https://github.com/wakumaku/ejabberd/blob/master/ejabberd.yml.example#L125
Ohh. Thanks, It worked like charm now.
Hello, I am trying to get the roaster $rpc->getRoster('48');
Fatal error: Uncaught exception 'RuntimeException' with message 'Error execution command 'get_roster'' with parameters array ( 'user' => '48', 'host' => 'localhost', ). Response: <?xml version="1.0"?>
In order to use the get_roster command you need to install the mod_admin_extra module in your ejabberd server
https://github.com/processone/ejabberd-contrib/tree/master/mod_admin_extra#L68
The suported calls you are able to do are the ones showed when you type
ejabberdctl
I am really sorry to disturb you again I have added both modules mod_admin_extra and mod_muc_admin. Now get roaster is working fine but again when i try to add roaster
Fatal error: Uncaught exception 'RuntimeException' with message 'Error execution command 'add_rosteritem'' with parameters array ( 'localuser' => '49', 'localserver' => 'localhost', 'user' => '48', 'server' => 'localhost', 'nick' => '49', 'group' => 'Friend', 'subs' => 'both', ). Response: ' in /var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/RpcClient.php:95 Stack trace: #0 /var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/Mixins/RosterTrait.php(113): GameNet\Jabber\RpcClient->sendRequest('add_rosteritem', Array) #1 /var/www/first/vendor/aaa.php(12): GameNet\Jabber\RpcClient->addRosterItem('49', '48', '49', 'Friend') #2 {main} thrown in /var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/RpcClient.php on line 95
No problem, but maybe this is not the best place where to discuss that because your errors are not related with library issues. My recomendation is to test the add_rosteritem from the command line to debug and get more detailed errors and when it works translate the command to your code.
I have resolved the issue. It appears i was using older mod_admin_extra file.
Thanks for your help
I am using this $rpc = new \GameNet\Jabber\RpcClient([ 'server' => 'http://localhost:5222', 'host' => 'localhost', 'debug' => true, ]);
I am getting this below error. What may be the issue?
Fatal error: Uncaught exception 'RuntimeException' with message 'Error execution command 'register'' with parameters array ( 'host' => 'localhost', 'user' => 'Ivan', 'password' => 'someStrongPassword', ). Response: <?xml version='1.0'?>stream:error /stream:error/stream:stream' in /var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/RpcClient.php:96 Stack trace: #0 /var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/Mixins/UserTrait.php(64): GameNet\Jabber\RpcClient->sendRequest('register', Array) #1 /var/www/first/vendor/aaa.php(10): GameNet\Jabber\RpcClient->createUser('Ivan', 'someStrongPassw...') #2 {main} thrown in /var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/RpcClient.php on line 96