XMPPHP和Openfire [英] XMPPHP and Openfire

查看:67
本文介绍了XMPPHP和Openfire的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是XMPP的新手,我希望基本上将PHP连接到本地主机上的OpenFire安装.

I'm a newbie to XMPP and I'm looking to basically connect the PHP to an OpenFire installation on my localhost.

这是我发现的一段代码(我知道用砍和斜线表示,但是我似乎无法绕开它).无论如何,代码只是简单地发送一条消息:

This is a piece of code I found (hack and slash I know but I can't seem to wrap my head around this). Anyway code just simply sends a message:

<?php
    include("xmpp.php");

    //username = user without domain, "user" and not "user@server" - home is the resource
    $conn = new XMPPHP_XMPP('my.server', 5222, 'username', 'password', 'home');
    // Enables TLS - enabled by default, call before connect()!
    $conn->useEncryption(true);
    $conn->connect();
    $conn->processUntil('session_start');
    $conn->message('someguy@someserver.net', 'This is a test message!');
    $conn->disconnect();

 ?>

我的问题是我应该用my.server代替什么?试着看,但是我什么都找不到

My question is what should I replace my.server with ? Tried looking but I couldn't find anything

家是资源

我不知道那意味着什么.

I have no idea what that means idea.

usernamepassword? 是我的OpenFire上的任何用户吗?

username and password ? Is that of any user on my OpenFire?

我正在寻找比完整解决方案更多的建议.谢谢你的一切.哦,新年快乐!

I'm looking for more advice than complete solutions. Thanks For Anything. Oh And Happy New Year!

推荐答案

实际上您也对Openfire有所了解,所以这才是关键.

Actually you also know a little about Openfire ,so this is the key point .

在这种情况下,Openfire是您的IM服务器,而php代码段是您的IM客户端.连接到IM服务器之前,应在Openfire管理控制台中进行一些配置.如您所说安装Openfire locahost,然后启动Openfire并在浏览器http://localhost:9090/中访问,如果您从未执行此步骤,则意味着您尚未完成Openfire的设置.进行配置时,您将看到admin用户设置和密码以及其他一些参数.完成此步骤后,您可以使用管理员用户名和密码登录Openfire.

In this case , Openfire is your IM Server and the php snippet is your IM client . Before you connect to your IM server you should make some configuration in Openfire admin console . As you said install Openfire locahost ,then start Openfire and visit in your browser http://localhost:9090/ , if you never do this step , this means you do not finish to setup Openfire . When you make configuration you will see the admin user setting and password and some other parameters . After this step , you can login to Openfire by your admin username and password .

如果您想测试更多用户,请再次访问Openfire管理控制台,然后单击用户"选项卡以增加新用户.

If you want to more test user , pleas visit Openfire admin console again ,and click user tab to new more users .

my.server =本地主机, home =您喜欢的任何字符串,这是XMPP中的资源,通常我们使用客户端应用程序版本(例如spark 2.0或xmpphp3.8).

my.server = localhost, home = any string you like , this the resource in XMPP usually we use client application version like spark 2.0 or xmpphp3.8 .

这篇关于XMPPHP和Openfire的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆