Reputation: 27
I am using Openfire 3.10.0 RTC Server (MySQL DB is "openrtc" @ localhost) and spark messenger. I can send Administrative or Broadcast Message to all users from
Admin Login => Sessions => Tools => Send Message => Send Administrative Message
I have "intranet" website with db "intr" for local/office staff. There is latest news section on front/home page of intranet. Whenever the admin adds latest news to the intranet, it is stored in MySQL table.
Is it possible to broadcast the same message to xmpp/ spark messenger that is either hit by php or stored in MySQL.
Upvotes: 0
Views: 772
Reputation: 21
I guess its too late to reply as its almost 2 years, you probably get the solution but may be someone else still looking for the answer. Here is the code which work for me.
#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", "[email protected]");
$conn->message('[email protected]', 'Test message!'); //Message
$conn->disconnect(); //disconnect
} catch (XMPPHP_Exception $e) {
die($e->getMessage());
}
Hope this help someone!
Upvotes: 1