I have set up an XMPP server, I have created the login form. PHP and HTML. I have not done this before, I want to know how to connect to XMPP server through PHP just like connecting to MySQL using PHP.
Asked
Active
Viewed 2.2k times
11
-
1`XMPP` is server just like `Apache`. – Yogesh Suthar Jul 23 '13 at 04:56
-
Hi try to follow http://youtu.be/o1dskkC1wdI – Achintha Samindika Jul 23 '13 at 10:30
-
1@nino did not asked what is XMPP. He asked how to make a connection to it using PHP. – Ivo Pereira Aug 23 '13 at 11:47
1 Answers
3
<?php
set_time_limit(0); // some time connection take while
require_once 'xmpp-lib/XMPPHP/XMPP.php';
$host = 'you Host name'; // ex.192.168.2.1
$port = '5222'; // its defauls xmpp port
$username = 'name@host' // ex vivek@host
$pass = 'userpass';
$conn = new XMPPHP_XMPP(host , $port, $username, $pass, 'xmpphp','yourhost', $printlog=false, $loglevel=XMPPHP_Log::LEVEL_INFO);
try {
$conn->connect();
$conn->processUntil('session_start');
$conn->presence();
$conn->message('anotherusername@host', 'Hello!');
$conn->disconnect();
} catch(XMPPHP_Exception $e) {
die($e->getMessage());
}
?>`enter code here`

vivek s vamja
- 1,001
- 10
- 11
-
2is it possible to integrate xmpp protocol with php web service to pass data over tcp/ip protocol? – Krutarth Patel Jan 27 '16 at 11:40
-
1