Exemple #1
0
function snapRegisterNewXmppUser($emailaddress)
{
    global $APPCONFIG;
    include_once '../extensions/XMPPHP/XMPPHP_XMPP.php';
    $conf = $APPCONFIG['XMPP'];
    $passwd = $conf['userpasswd'];
    $userJID = cleanString($emailaddress) . time() . '@' . $conf['server'];
    $conn = new XMPPHP_XMPP($conf['server'], $conf['port'], $conf['adminuser'], $conf['adminpasswd'], $conf['resource'], $conf['domain']);
    $conn->autoSubscribe(true);
    $conn->useEncryption(false);
    $resp = array();
    try {
        $conn->connect();
        $conn->processUntil('session_start');
        $conn->registerNewUser($userJID, $emailaddress, $passwd);
        $conn->processUntil('done');
        $conn->disconnect();
        return array('xmppuserid' => $userJID, 'xmpppasswd' => $passwd);
    } catch (XMPPHP_Exception $e) {
        return 0;
        //die($e->getMessage());
    }
}
Exemple #2
0
<?php

include_once 'extensions/XMPPHP/XMPPHP_XMPP.php';
$conf = array('server' => 'localhost', 'port' => '5222', 'userName' => 'admin', 'passwd' => 'password', 'resource' => 'xmpphp', 'domain' => 'myxmpp.com');
$email = '*****@*****.**';
$userJID = '*****@*****.**';
$passwd = 'asdasdasd@34';
$conn = new XMPPHP_XMPP("myxmpp.com", $conf['port'], $conf['userName'], $conf['passwd'], $conf['resource'], 'myxmpp.com');
$conn->autoSubscribe(true);
$conn->useEncryption(false);
try {
    $conn->connect();
    $conn->processUntil('session_start');
    $conn->registerNewUser($userJID, $email, $passwd);
    $conn->processUntil('done');
    $conn->disconnect();
} catch (XMPPHP_Exception $e) {
    die($e->getMessage());
}