XMPPHP and Openfire

丶灬走出姿态 提交于 2019-12-23 06:57:41

问题


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 question is what should I replace my.server with ? Tried looking but I couldn't find anything

Also

Home is the resource

I have no idea what that means idea.

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!


回答1:


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

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 .

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

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 .



来源:https://stackoverflow.com/questions/14112624/xmpphp-and-openfire

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!