During the hype with ICQ and the suggestions for switching to jabber, I decided to figure out what jabber is and how it can be useful to me besides direct communication.
The application was found by itself - I want to receive comments from the site itself in the messenger. This approach was very convenient and easy to implement.
Since I just started to deal with Jabber, I decided to use the ready library for php (since my site works on it).
So, on the xmpp (jabber)
xmpp.org/software/libraries.shtml website, I downloaded the xmpphp library (I liked it most with its simplicity in understanding) and downloaded it to my host.
')
I added lines to the function of adding a comment on the site:
include 'XMPPHP / XMPP.php';
$ conn = new XMPPHP_XMPP ('Jaber server', 5222, 'login', 'password', 'xmpphp', 'jabber.ru', $ printlog = false, $ loglevel = XMPPHP_Log :: LEVEL_INFO);
try
{
$ conn-> connect ();
$ conn-> processUntil ('session_start');
$ conn-> presence ();
$ conn-> message ('your jabber', 'message text');
$ conn-> disconnect ();
}
catch (XMPPHP_Exception $ e)
{
die ($ e-> getMessage ());
}
Where: Jabber server - the server through which messages are sent (I indicated the same to which the messages come).
Attention! Message text must be UTF-8 encoded.
That's all ...
PS Thanks for the invitation to habr! I decided to transfer my article from the sandbox to the blog.