我正在使用Openfire 3.10.0 RTC服务器(MySQL数据库是" openrtc " @ localhost)和spark messenger。我可以从
向所有用户发送管理或广播消息Admin Login => Sessions => Tools => Send Message => Send Administrative Message
我有" intranet" 网站,其中db " intr" 适用于本地/办公室员工。内联网的前/主页上有最新的新闻栏目。每当管理员向Intranet添加最新消息时,它都存储在MySQL表中。
是否可以向xmpp / spark messenger广播相同的消息,该消息由php命中或存储在MySQL中。
答案 0 :(得分:0)
我认为它已经太迟了,因为它已经差不多2年了,你可能会得到解决方案,但也许还有其他人仍在寻找答案。这是适合我的代码。
#Sender User name = foo
#Sender User Password = ****
#Receiver User name = bar
#Server name = soo.com
#Server IP = xx.xxx.xxx.xx
require 'XMPPHP/XMPP.php'; //you must include XMPP.php file you will get all bunch of files from https://github.com/cweiske/xmpphp
$conn = new XMPPHP_XMPP('xx.xxx.xxx.xx', 5222, 'foo', '****', 'xmpphp', 'soo.com', true, XMPPHP_Log::LEVEL_INFO);
try {
$conn->connect(500); //Connection with Timeout in seconds
$conn->processUntil('session_start'); //process session start
$conn->presence(NULL, "available", "bar@soo.com");
$conn->message('bar@soo.com', 'Test message!'); //Message
$conn->disconnect(); //disconnect
} catch (XMPPHP_Exception $e) {
die($e->getMessage());
}
希望这能有所帮助!