Manage chatroom with php

Hi,

I need to mange a chatroom with php language. I use xmpphp library, but if there is a library better, I can change it.

In particular I want to create a chat room to send the same message to multiple users.

I’m using this code:

$conn = new XMPPHP_XMPP('server_ip', 5222, 'myuser', 'mypassword', 'xmpphp', 'server_ip', $printlog=true, $loglevel=XMPPHP_Log::LEVEL_INFO);
$conn->connect();
$conn->processUntil('session_start');
$conn->presence(NULL, "available", "testchatroom@127.0.0.1/myuser");
$conn->message("testchatroom@127.0.0.1", "Test!", "groupchat");
$conn->presence(NULL, "unavailable", "testchatroom@127.0.0.1/myuser");
myuser

but nothing happens.

The log is

1298568538 [INFO]: Connecting to tcp://server_ip:5222
1298568538 [INFO]: Starting TLS encryption
1298568538 [INFO]: Attempting Auth...
1298568538 [INFO]: Auth success!
1298568539 [INFO]: Bound to myuser@127.0.0.1/xmpphp
1298568539 [INFO]: Session started

The user “myuser” is logged to “server_ip” through pidgin. I can see it in openfire control panel.

With the previous code I expect to join to chatroom called “testchatroom” and receive the message “Test!”, but nothing.

I have also checked if in openfire control panel the room was created. Unfortunately no.

What’s wrong?

The following code works correctly:

$conn = new XMPPHP_XMPP('server_ip', 5222, 'myuser', 'mypassword', 'xmpphp', 'server_ip', $printlog=true, $loglevel=XMPPHP_Log::LEVEL_INFO);
$conn->connect();
$conn->processUntil('session_start');
$conn->presence();
$conn->message('myuser@127.0.0.1', 'This is a test message!');
$conn->disconnect();

Thanks