【问题标题】:broadcast message from Openfire to Spark/XMPP client using PHP / MySQL使用 PHP/MySQL 从 Openfire 向 Spark/XMPP 客户端广播消息
【发布时间】:2015-05-28 04:20:48
【问题描述】:

我正在使用 Openfire 3.10.0 RTC 服务器(MySQL DB 是“openrtc”@ localhost)和 spark messenger。我可以从

向所有用户发送管理或广播消息
Admin Login => Sessions => Tools => Send Message => Send Administrative Message

我有 "intranet" 网站,其中包含 db "intr" 供本地/办公室工作人员使用。内网首页/首页有最新消息栏目。每当管理员向内网添加最新消息时,它都会存储在 MySQL 表中。

是否可以向 xmpp/spark messenger 广播相同的消息,该消息要么被 php 命中,要么存储在 MySQL 中。

【问题讨论】:

    标签: jsp openfire broadcast php-5.5


    【解决方案1】:

    我想现在回复已经太迟了,因为它已经快 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());
        }
    

    希望这对某人有所帮助!

    【讨论】:

      猜你喜欢
      • 2016-12-02
      • 1970-01-01
      • 2018-11-14
      • 2014-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-15
      相关资源
      最近更新 更多