public function __construct($username, $password, $email)
 {
     parent::__construct($host = "121.40.92.53", $port = 5222, $printlog = true, $loglevel = XMPPHP_Log::LEVEL_INFO);
     $this->stream_start = '<stream:stream to="' . $host . '" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0">';
     $this->stream_end = '</stream:stream>';
     $this->default_ns = 'jabber:client';
     $out = "";
     if (!$this->isDisconnected()) {
         $out .= "<iq type='set' id='uid2'>\n\t\t\t\t<query xmlns='jabber:iq:register'>\n\t\t\t\t<username>{$username}</username>\n\t\t\t\t<password>{$password}</password>\n\t\t\t\t<email>{$email}</email>\n\t\t\t\t</query>\n\t\t\t\t</iq>";
     }
     $this->send($out);
 }
Esempio n. 2
0
 /**
  * Constructor
  *
  * @param string  $host
  * @param integer $port
  * @param string  $user
  * @param string  $password
  * @param string  $resource
  * @param string  $server
  * @param boolean $printlog
  * @param string  $loglevel
  */
 public function __construct($host, $port, $user, $password, $resource, $server = null, $printlog = false, $loglevel = null)
 {
     parent::__construct($host, $port, $printlog, $loglevel);
     $this->user = $user;
     $this->password = $password;
     $this->resource = $resource;
     if (!$server) {
         $server = $host;
     }
     $this->server = $server;
     $this->basejid = $this->user . '@' . $this->host;
     $this->roster = new Roster();
     $this->track_presence = true;
     $this->stream_start = '<stream:stream to="' . $server . '" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0">';
     $this->stream_end = '</stream:stream>';
     $this->default_ns = 'jabber:client';
     $this->addXPathHandler('{http://etherx.jabber.org/streams}features', 'features_handler');
     $this->addXPathHandler('{urn:ietf:params:xml:ns:xmpp-sasl}success', 'sasl_success_handler');
     $this->addXPathHandler('{urn:ietf:params:xml:ns:xmpp-sasl}failure', 'sasl_failure_handler');
     $this->addXPathHandler('{urn:ietf:params:xml:ns:xmpp-tls}proceed', 'tls_proceed_handler');
     $this->addXPathHandler('{jabber:client}message', 'message_handler');
     $this->addXPathHandler('{jabber:client}presence', 'presence_handler');
     $this->addXPathHandler('iq/{jabber:iq:roster}query', 'roster_iq_handler');
     // For DIGEST-MD5 auth :
     $this->addXPathHandler('{urn:ietf:params:xml:ns:xmpp-sasl}challenge', 'sasl_challenge_handler');
 }
Esempio n. 3
0
 /**
  * Constructor
  *
  * @param string  $host
  * @param integer $port
  * @param string  $user
  * @param string  $password
  * @param string  $resource
  * @param string  $server
  * @param boolean $printlog
  * @param string  $loglevel
  */
 public function __construct($host, $port, $user, $password, $resource, $server = null, $printlog = false, $loglevel = null)
 {
     parent::__construct($host, $port, $printlog, $loglevel);
     $this->user = $user;
     $this->password = $password;
     $this->resource = $resource;
     if (!$server) {
         $server = $host;
     }
     $this->basejid = $this->user . '@' . $this->host;
     $this->stream_start = '<stream:stream to="' . $server . '" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0">';
     $this->stream_end = '</stream:stream>';
     $this->default_ns = 'jabber:client';
     $this->addHandler('features', 'http://etherx.jabber.org/streams', 'features_handler');
     $this->addHandler('success', 'urn:ietf:params:xml:ns:xmpp-sasl', 'sasl_success_handler');
     $this->addHandler('failure', 'urn:ietf:params:xml:ns:xmpp-sasl', 'sasl_failure_handler');
     $this->addHandler('proceed', 'urn:ietf:params:xml:ns:xmpp-tls', 'tls_proceed_handler');
     $this->addHandler('message', 'jabber:client', 'message_handler');
     $this->addHandler('presence', 'jabber:client', 'presence_handler');
 }