문제

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!

도움이 되었습니까?

해결책

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 .

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top