Introducing JAXL – Open Source Jabber XMPP Library

Introducing JAXL – Open Source Jabber XMPP Library


JAXL stands for “Jabber XMPP Library“. For fun, it stands for “Just Another XMPP Library

This library currently supports following features:

  • Connect to a Jabber Server (e.g. Gtalk)
  • TLS Encryption
  • DIGEST-MD5 and PLAIN authentication mechanisms
  • Roster Support

Library comes with the following class files:

  1. config.ini.php : Holds your jabber account and mysql connection information
  2. mysql.class.php : Basic MySQL connection class used to insert received messages and presence into MySQL database
  3. logger.class.php : A very basic logger class which allows you to log all XML stanza’s send and received from jabber server
  4. xmpp.class.php : Base XMPP class library which implements the XMPP protocol
  5. jaxl.class.php : JAXL class which extends XMPP class library. Should be the starting point for your application.
  6. index.php : After building your application in jaxl.class.php, you finally initializa and call your methods here

Source Code
JAXL is hosted at Google Code. Checkout full source code from here:

Google Groups
Visit this group

How to use JAXL:
JAXL Client Library is highly structured. There is a base XMPP class library (xmpp.class.php) and a JAXL class library (jaxl.class.php) which is derived from the base XMPP class library.

Base XMPP class library implements the XMPP protocol and it also provides you with two extendable methods named eventMessage() and eventPresence(). These methods are internally called when a message or presence XML Stanza is received from the Jabber server.

Jaxl.class.php must be the starting point for all your applications. Simply customize the eventMessage() and eventPresence() Method for your application. Other methods which might interest you while customizing them are:

  1. sendMessage($jid,$message) : For sending message to a particular Jid
  2. sendStatus() : To set your status message
  3. roster(‘get’) : To get list of roster
  4. roster(‘add’,$jid) : Add a new contact in roster list
  5. roster(‘remove’,$jid) : Remove a contact from roster list
  6. roster(‘update’,$jid,$name,$groups) : Update a particular contact in roster
  7. subscribe($jid) : Subscribe for presence of a particular $jid

This library includes the following files:

Config File (config.ini.php)
You specify all your jabber account username and password in this file. For development environment keep $env = “devel” and for production simply change it to $env = “prod”

  // Set an enviornment
  $env = "prod";

  // Log Level for logger class
  $logEnable = TRUE;

  // Log in MySQL database
  $logDB = FALSE;

  $key = array("prod"=>array("user"=>"myproductionuser",

  $db = array("prod"=>array("dbuser"=>"root",

MySQL Class (mysql.class.php)
This is a basic MySQL connection class used to insert received messages and presence into MySQL database

Base XMPP Class (xmpp.class.php)
You should not worry about this class. Until and unless you are aware of what are you trying to achieve you should not touch this class file.

Logger Class (logger.class.php)
This is a basic logger class. It help you log XML send to and received from jabber server. Might prove helpful in debugging and if you are interested in learning the core of XMPP Protocol.

Extended JAXL Class (jaxl.class.php)
You will be customizing eventMessage() and eventPresence() methods here.

    function eventMessage($fromJid, $content, $offline = FALSE) {
      if($offline) {
        $this->sendMessage($fromJid,"Hi, Thanks for your offline message");
      else {
        $this->sendMessage($fromJid,"Hi, Thanks for your message");

      if($this->logDB) {
        // Save the message in the database
        $timestamp = date('Y-m-d H:i:s');
        $query = "INSERT INTO message (FromJid,Message,Timestamp) value ('$fromJid','$content','$timestamp')";

    function eventPresence($fromJid, $status, $photo) {
      // Change your status message to your friend's status

      if($this->logDB) {
        // Save the presence in the database
        $timestamp = date('Y-m-d H:i:s');
        $query = "INSERT INTO presence (FromJid,Status,Timestamp) value ('$fromJid','$status','$timestamp')";

In above example I have done 4 things:

  • Sends back a message saying “Hi, Thanks for your offline message”, when I receive a offliner.
  • Sends back a message saying “Hi, Thanks for your message”, when I receive an IM from my friend.
  • Change my status message, as and when I receive a status update from my friends.
  • Save messages and presence into database if $logDB = TRUE in config.ini.php

Final Call (index.php)

  /* Include Key file */

  /* Include JAXL Class */

  /* Create an instance of XMPP Class */
  $jaxl = new JAXL($key[$env]['host'],    // Jabber Server Hostname
                   $key[$env]['port'],    // Jabber Server Port
                   $key[$env]['user'],    // Jabber User
                   $key[$env]['pass'],    // Jabber Password
                   $key[$env]['domain'],  // Jabber Domain
                   $db[$env]['dbhost'],   // MySQL DB Host
                   $db[$env]['dbname'],   // MySQL DB Name
                   $db[$env]['dbuser'],   // MySQL DB User
                   $db[$env]['dbpass'],   // MySQL DB Pass
                   $logEnable,            // Enable Logging
                   $logDB                 // Enable MySQL Inserts

  try {
    /* Initiate the connection */

    /* Communicate with Jabber Server */
    while($jaxl->isConnected) {
  catch(Exception $e) {

Instant Messenger Powered by JAXL
I am pleased to announce 3 months after release of JAXL, 1st Instant Messenger powered by JAXL. Currently the instant messenger is in testing phase and will be released after some 3-4 weeks of thorough testing. Meanwhile here is the first clip shot:

Currently this library is being developed and used at . Though it is thoroughly tested and being used, I still recommend not to use it on production servers. Mainly, since it is heavily customized for Gtalkbot’s usage. I am releasing it, as I see it of use for the community worldwide. If you want to use it, use at your own risk. Let me know of any changes you make to this library. In future I look to make this library more generic.

Enjoy and let me know of any bugs, feedbacks, enhancements or any abuse you may want to pass through if it doesn’t work for you 😛

You should be running index.php using command line and not browser (recommended). This class is currently highly customized for Gtalkbots usage and works perfectly with Gtalk Servers.


  1. Pingback: Behind the scenes - How and What XML’s are exchanged by JAXL | Abhi's Weblog

  2. x1311

    Hi there,
    very interesting Library. What I am mostly interested in is how eventMessage() gets called internally. Could you describe the whole message flow with core components?

  3. Yeah in the case study of google talk server, i did missed the XML stanza’s being transmitted when a message is sent or received.

    Here is what JAXL receives when a message is sent:

    <message to=”[email protected]” type=”chat” id=”325″ from=”[email protected]/Talk.v104233E14DB”><body>Hi dood</body><active xmlns=””/><nos:x value=”disabled” xmlns:nos=”google:nosave”/><arc:record otr=”false” xmlns:arc=””/></message>

    So you can see that along with incoming XML, Gtalk server also tells you about the features supported by Gtalk server.

    Here is what you will receive for an offline message:

    <message to=”[email protected]” from=”[email protected]”><body>Hi dood</body><x stamp=”20090104T16:27:25″ xmlns=”jabber:x:delay”/><time ms=”1231086445192″ xmlns=”google:timestamp”/></message>

    Hence from the incoming XML stream, you know that it’s an off liner.

    I hope this is what you asked for. See the example jaxl.class.php where I have handled both online and offline messages separately.


  4. Hi Abhi

    Many thanks for sharing your excellent work with all. We are newbies trying to code a chatbot and your library is very helpful. I have two off-topic comments to make:

    1. The wordpress theme and especially its name is great. 🙂
    2. How are these geometric image avatars generated for commenters on your blog?


  5. Thanks Vinayak. I would love to list your application on Jaxl’s google code page. Kindly let me know when you are done with your application.

    About the theme name, well that was my nick name back in college, so tried playing with that.

    About the Geometric Image Avatars, well they are generated by Gravatar. Nothing to do with my theme or code.

    Do lemme know about your application and all the best 🙂

  6. Gaurav


    I am trying to learn how to create gtalk powered bots. I want to create a bot that translates words from english to hindi. For example, if you send the word “One” the bot should reply back with “ek”. For this purpose I have created a php script that takes a word as input, looks up in a database and returns an output.

    Now I want to connect this php script to the bot. I have also created an account on gmail to act as a bot [[email protected]].

    My question is that now how do I connect this php script to the gmail bot? What is the role of Jaxl in this? My understanding of the process is this:

    1. User sends keyword through gtalk to gmail jabber server
    2. Gmail jabber server sends the message to [email protected]
    3. dictionaribot… transmits the keyword to the php script
    4. the php script looks up keyword in mysql database and returns a value
    5. the value is transmitted to the user through the jabber server.

    My confusion is as to how is information transferred in steps 3 and 5 above. how is the connection between the gtalk message and the php script is made?

    I am sorry if the question is stupid but I am a beginner and trying to just enter into this field.


  7. Hi Gaurav,

    No worries, we all start from basic. What you want to achieve is quite straight forward if you are using JAXL. I hope by now u understand how to make use of JAXL.

    For your application you simply need to customize the eventMessage() method in jaxl.class.php.

    From my guess it will look like this:
    function eventMessage() {
    if(!$offline) {
    // Grab the sentence passed by the user
    $sentence = trim($content);
    // Now simply lookup in your database or use google language api’s to convert this sentence to hindi
    $translatedSentence = database_lookup($content);
    // If you wish acknowledge JAXL library
    $translatedSentence .= “npowered by Jaxl“;
    // Finally send back the translated sentence

    You simply have to replace the database_lookup function with your application code.  (For more idea see the source code of jaxl4dzone.class.php)

    However I guess there is already some bots released by Google themselves for such translations.

    All the best! Do lemme know when you are done with your application, I will list that on the Jaxl google code page 🙂

  8. Gaurav

    Hi Abhinav

    Thanks for the prompt reply. I would request you to be a little patient with me on this.

    I have understood the way to handle the operations once the message is recd by the php file.

    However, I am confused as to how to send messages received on the [email protected] id to the index.php file on my web server.

    Right now this is what is happening:

    [email protected] > [email protected]

    But for the bot to work, what should happen is:

    [email protected] > [email protected]>index.php>mySQL>index.php>[email protected] > [email protected]

    How does one transmit info from the jabber id to the php file?

    Thanks in advance for your support.

  9. Gaurav

    To clarify the above message – how do I initiate the execution of the index.php page? It is lying on my XAMPP web server. Should I create a cron job that executes index.php after a set period of time.

  10. I guess the following workflow will help you:

    • [email protected] sends a message saying “One” to [email protected]
    • [email protected] receives it as $content and $fromJid contains email id of the sender
    • Now you will have to do one of the following things: (i) Either you create a class out of your index.php file and then include it in jaxl.class.php. Then send “One” to this class from within eventMessage() method and receive “ek” (ii) Put the whole index.php logic inside eventMessage() method, so that you translate $content inside eventMessage() method itself, before sending it back to $fromJid
    • There is no problem with querying database inside eventMessage() method.

    Simply set $logDb = TRUE in config.ini.php and then change the $query inside jaxl.class.php to what ever query you want to. Get back the required translation from the database and send it back to the user.

    I hope this shd definitely get you going. All the best.
    PS: No need of any cron job or any other trick.

  11. Gaurav

    Sorry to bother you again. But the place where I am still confused is quoted below:
    send “One” to this class from within eventMessage() method and receive “ek”

    How this will happen both are separate containers?

    Thanks in advance

  12. I guess u need to just read a little about OOPS. You can very well make a class out of your application which queries the database and gets the translated data. Then include this class in jaxl.class.php, create a new object. Pass $content using this object to your application class and get back the translated results in the jaxl.class.php itself. 🙂

    I guess give a lill fight and u will get thr. All the best, leaving for party 🙂

  13. Vinayak


    I have been reading with interest the discussion between Abhi and Gaurav. Abhi – I think the continued confusion is because the problem is not clear and you are offering the solution for the wrong problem. I made a diagram showing the process and the part where gaurav is facing a problem.

    Take a look:

    The problem I think lies in part 2 of the process. While Abhi is telling the solution for part 3 and 4, which I think Gaurav has worked out using Jaxl.

    Gaurav, pls confirm my understanding.

  14. Well I m not sure how could I hve made a similar diagram, but here is the flow diagram which I would like to present.

    » User’s PC 
    » User logon to Gtalk messenger 
    » Open up [email protected] for translation 
    » Type in “One” in the chat window and press enter 
    » This message goes to Gtalk Jabber Servers, who sees that User is trying to send this message to [email protected] and redirects that message to [email protected] 
    » [email protected] is running as a bot on gaurav’s php server
    » The message is received by eventMessage() method inside JAXL class
    » Now inside this class, gaurav receives this status message as $content and then Gaurav’s code will fire a SQL query to the database from within eventMessage() method. It will be something like this. $query = “SELECT hindi_translation where english_word = ‘One'”;
    » Gaurav’s code will receive the returned $resultset, and now gaurav will send back this translated message to User using $this->sendMessage()
    » This message will again first go to Gtalk server which will redirect this message to the intended user.

    I am not sure if this is what you are looking for from me. However I wish you will be able to get that working now 🙂

    All the best!

    PS: I have uploaded this image on tinyurl so that it doesn’t vanish for future readers 🙂

  15. Gaurav

    Yes I agree with Vinayak. Now there is only 1 doubt left i.e.

    how to get the bot running on the server?

    More specifically, please refer to this line of your explanation:
    » [email protected] is running as a bot on gaurav’s php server

    I tried executing the index.php file and got this warning:

    Warning: fwrite(): supplied argument is not a valid stream resource in /home/iilvin/public_html/dictionari/jaxl/xmpp.class.php on line 152

    I am also copy pasting Log file entries:
    Log file entries:

    2009-01-15 03:25:02
    Initializing class variables

    2009-01-15 03:25:02
    Trying to connect at

    2009-01-15 03:25:23
    Failed to establish a connection at

    2009-01-15 03:25:23
    Sending XML>>


  16. [email protected] is running as a bot on gaurav’s php server

    This part means that on your server, you have started the bot using command line. More specifically this means you have issued the following command php index.php in the directory where JAXL recides and it has started successfully.

    I am also copy pasting Log file entries”
    Well looking at the log enteries and the warning which you got, I guess you are on a shared hosting and you are for some reasons not allowed to open a TCP connection. Do check with your host provider if a PHP command like fsockopen, stream_set_blocking, stream_set_timeout is allowed for you. If unfortunately the answer is NO, you can’t run JAXL on your server. Infact none of the XMPP library will be able to run successfully.
  17. Gaurav

    Hi Abhi,

    The delay has been because the hosting provider had an elaborate mechanism for granting permission for shell access. We got the permission to run commans through commandline yesterday only.

    Now when I login I get the following response:

    log: Initializing class variables
    log: Trying to connect at
    log: Failed to establish a connection at
    log: Sending XML>>
    Warning:  fwrite(): supplied argument is not a valid stream resource in /home/iilvin/public_html/dictionari/jaxl/xmpp.class.php on line 152

    It seems we need to specifically ask permission for running the commands that you mentioned. I am raising a ticket for the same today. Will keep you informed of the progress.

  18. Gaurav

    Hi Abhi,

    I got this reply from my hosting provider:

    Commands allowed: “fsockopen”, “stream_set_blocking”
    Commands not allowed: “stream_set_timeout”

    Pls suggest me if there is any workaround to the command – stream_set_timeout.

    Or if you could suggest a web host that supports all the required configurations. Where are you hosting your site?


  19. well i doubt you can go ahead with this hosting then. Well I have my own virtual private server so I have full control on my server. You may want to try I used it when I started web development, though I am not sure if you have these commands allowed there again.

    However this shd work perfectly on your local system, coz you won’t have any restrictions set thr.
    All the best
  20. Gaurav

    Hi Abhi,

    I am planning to go for my own virtual private server. Vendors are asking for server configration. Pls suggest if the configration below is fine or any changes are required?

    Disk Space: 10 GB
    Monthly Bandwidth Transfer: 100 GB
    cPanel Version: 10.x or above
    Apache Version: 2.2.x (Unix)
    PHP Version: 5.2.8
    MySQL version: 5.x or above
    Architecture: x86_64
    Operating System: Linux [which flavor would you suggest?]
    RAM: 2GB

  21. Gaurav it depends on your need and how much resources you will be needing. I guess you can go ahead with the above configuration of disk space and ram. But I didn’t get why did you mentioned the PHP, Apache and MySQL versions. That is all in your hand and you will need to configure yourself, unless your VPS hosting provider is giving you pre-configured VPS…. 

    I personally use debian as OS. So if you want you can go ahead with the same. If you get Ubuntu, you can get that too, its similar to ubunut.
  22. Anyhow i am working with jaxl library..  to create an anagram games bot like … I am not a hardcore programmer So i dont know the % of success … if that gtalkbots anagram code  is an open source then i need hardly need that code… Thank You for Developing Such an good jaxl Library..

  23. Thanks Yuva….Well the plan if ofcourse to release that too. I have already released a few sample applications and target is to keep producing more sample applications which can show the power of JAXL and XMPP Protocol.

    However the code was written about 6 months back in a hurry and is not so well structured. Need to restructure the same, before I release it for other developers. Don’t want to churn out a bad practice code in public 😉
  24. Gaurav

    Hi Abhi

    I now have access to a VPS with LAMP.  I was able to get the dictionaribot working finally using JAXL. 🙂

    Next I installed a jabber server (jabberd) and tried to create an account using the Exodus chat client installed on my local windows machine. However I got this error:
    Looking up SRV:
    Got A:  5222
    SENT: <stream:stream to=”” xmlns=”jabber:client” xmlns:stream=””  xml:lang=”en” version=”1.0″ >
    RECV: <?xml version=’1.0′?><stream:stream xmlns:stream=’’ id=’49919FC7′ xmlns=’jabber:client’ from=’’>
    SENT: <iq id=”jcl_2″ type=”get”><query xmlns=”jabber:iq:auth”><username>abcd</username></query></iq>
    RECV: <stream:error>Disconnected</stream:error></stream:stream>

    Can you help me with this?

    Many thanks in advance.

  25. Hi Gaurav,

    First of all congratulations on your bot. I would ask you to kindly let me know your bot email-id so that I can list it on the pages of JAXL.
    Further, you can create a new account in ejabberd using the admin panel directly. You don’t need any chat client for that. I am not sure what this error is, probably can investigate later and let you know. As of now you can open the admin panel of ejabberd and create user account from there.

    A quick google search gives me this, probably this can be of some help:

    PS: Do let me know your bot email-id
  26. Pingback: Programatically control your google mails using JAXL v 1.0.4 | Abhi's Weblog

  27. Gaurav

    Hi Abhi

    The bot is not functional as yet. We are still struggling with a few issues. I will let you know all the details once we get it going. Many thanks for your ongoing help and interest.

    There are 2 main issues that we face:

    1. We are running the php file by logging on to our VPS through the console provided by PuTTY which is a free telnet and SSH Client for Windows and Unix platforms.  But as soon as I close the PuTTY executable on my local machine, the bot goes offline on the VPS.

    2. Can JAXL work with non-gmail bots? Can I host my own bot?


  28. Hello, i need to add a jabber web client to my wordpress web page but my emplyer dont want to use the wordpress plugin. I`m trying to use the JAXL library but when i set up the config file, i get this error
    <failure xmlns=’urn:ietf:params:xml:ns:xmpp-sasl’>
    I add a new test user to my jabber server (I`m using EjabberD) and double check the username and password.
    Any idea?
    Thanks in advance

  29. Hi,

    Strange enough. BTW can you confirm if you have updated your username and password under the right enviornment, i.e. probably you have added ur username and password under dev enviornment and you have $env = “prod” set.

    Also can you kindly send in the complete logs till you get the above error for more debugging.

  30. Vinayak

    Hi Abhi

    In your anagram bot, how do you remember the user’s state? For example if you have sent him a jumbled word and he asks for a hint, how do you know which word’s hint should be sent. Because at any time, a number of users must be chatting with the bot. And each user could be on a different word.

    Do you create some session or something? Or do you store and retrieve values in a db?

    Thanks in advance

  31. You got it wrong actually. At any point in time, all users are trying to answer the same jumbled word. The one who answers first (and believe me the difference is in micro seconds) wins the round.

    However if you plan to keep a user session independent of each other, than you need to maintain a session on server side, which will contain information on user basis. 
    Getting this from Db is not at all recommended. Best is to use memcache. Read this post of mine on how to use memcache.
  32. Pingback: How to broadcast a message to your Gtalk friends using JAXL? | Abhi's Weblog

  33. Pankaj

    Hi, I have a debian server. I was using jaxl library but now i am using xmpphp library for bot development as i have to use bosh .
    Is there any provision of bosh under jaxl library?

    When i create a bot using xmpphp library i.e through xmpp file its working fine but when i try to use bosh it generates a fatal error.

    Fatal error: Uncaught exception ‘Exception’ with message ‘String could not be parsed as XML’ in /var/www/testlib/XMPPHP/BOSH.php:75 Stack trace:

    0 /var/www/testlib/XMPPHP/BOSH.php(75): SimpleXMLElement->__construct(”)

    1 /var/www/testlib/index.php(14): XMPPHP_BOSH->connect(‘myserver’)

    2 {main} thrown in /var/www/testlib/XMPPHP/BOSH.php on line 75

    Can you Please help me on this?


  34. As far as I know, XMPPHP is not fully bosh compatible. It provides you a kind of backend code for bosh implementation, but for clubbing that with browser you need to write your own wrappers.

    Bosh support is already present in JAXL, though not released yet. I am planning to release that by mid next month. (busy with other commitments)
    Reason why I build JAXL after initially using XMPPHP was, I found XMPPHP was having memory leakage. Try running your bot for a week and you will find the bot will die out with memory exception. On JAXL, i haven’t seen any memory outage as of now 😀
    BTW why did you moved to XMPPHP from JAXL, any specific reasons?

  35. Pankaj

    Thanks for your prompt reply.
    My main reason of moving out to xmpphp was bosh support specifically for state remembrance/session maintenance .


  36. Pingback: 5 exciting (gaming) bots you can create using Jaxl (Jabber XMPP Library) in PHP | Abhi's Weblog

  37. Pankaj

    Hi Abhi,
    Thanks for your cooperation regarding our queries.
    I want to know whether its possible to implement pubsub functionality in jaxl, if its possible then how?
    My scenario is : user subscribes to an event & when an event occurs message is sent to all the subscribers.
    I have debian server with openfire.
    Can you please help me on this?

  38. I guess you are referring to as pubsub right? Well unfortunately thats not a part of Jaxl yet, but seriously I want to have that in Jaxl soon.

    However if you want to simulate pubsub model using current Jaxl library, here is how you can go ahead (never tested or tried, but i guess should work. No idea how scalable it will be).

    1. Create a master bot say with jid: [email protected]
    2. You can code the eventMessage() method for the master bot in such a way that on receiving a particular message say “subscribe”, master bot will subscribe the sender jid. You can write through to backing store like MySQL.
    3. Further events that occur can again be captured by customizing eventMessage() and eventPresence() functions. You will need to tweak them in a way so that they are triggered for all possible event types. For e.g. You capture the event, “Whenever [email protected] changes his status” and as soon as you capture this inside eventPresence() you broadcast the required details to all subscribed users.

    For scalability you might want to use memcached or other such distributed caches. Lemme know if you make any progress on this, you can release that as jaxl4pubsub.class.php 😀

  39. Pankaj

    Hi Abhi,
    Thanks for your reply i will try pubsub functionality later on as i am facing a critical issue.
    Actually my bot goes offline very frequently. I have already applied the ping method as stated by some users. I have also checked the log file but could not found out the reason for it. Then i checked  nohup.out file . It contains
    Warning: fwrite(): SSL operation failed with code 1. OpenSSL Error messages:
    error:1409F07F:SSL routines:SSL3_WRITE_PENDING:bad write retry in /var/www/bot/xmpp.class.php on line 153
    May be this is causing some problem?
    One more thing my debian server is having 256 MB RAM whereas openfire config file has this setting:
    DAEMON_OPTS=”-Xms256m -Xmx512m”
    i.e. memory limit from 256-512
    May be this is also the reason ? I am little bit confused whether less memory of my server is causing some issue or the error in the nohup.out is causing memory leakage?
    Can you please guide me on this?


  40. Pankaj

    Hi Abhi,
    I have php version 5.2.6-1+lenny2. One more thing  i would like to know whether its due to this error my bots are going offline or less memory of server causing this issue.
    Please help.

  41. Pankaj

    Thanks Abhi for replying there is no such fixed time frame for my bots getting offline. Sometimes in two days its getting offline. Yesterday i have reststarted the bot but today its offline again. May be low memory of server causing this as yesterday while testing on openfire server i checked that when java memory reached above 250 mb the server hanged then i have to restart the server.
    It would be a great help if you can provide me a link how to use xdebug. I have no idea about it.

  42. Xav

    Any idea if I could use sendMessage to send message to other networks?my jabber server has some gateways installed and most accounts have a Yahoo! account associated with them, though if I use sendMessage with a $jid for the request never works.
    Have you tried this by any chance?

  43. Hi Xav,

    Yes you can send messages across the networks too, but then you will need to have s2s configured i.e. server to server configs. I haven’t played around much with these but if you see the jabber config file you will get an idea. Yahoo, MSN, IRC integration are possible though that will require some configs.

    All the best.

  44. Hi Doublet,

    I am currently working on memchat. Delay in Jaxl based webclient is happening because I am moving the javascript FE part to jQuery. (initially i coded using plaing javascript).

    Also another reason is the time limits at my end. I will appreciate if a couple of interested developers can step in and help me completing this project.


  45. Hi abhi,
    i have trying jaxl to communicate with my local jabber server.
    jaxl is successfully connected with my server, but failed when starting TLS encryption, it’s indicated some problrm with my stream_socket_enable_crypto() function, please give me your solution.

    are your eventMessage() could handle jabber conference chat?

    thank for your nice library 🙂

    1. Hi Ashley,

      Well i haven’t tried running on PHP4. Probably you can try and let me know if you encounter any problem. Will be eager to fix them up. (I never planned to run it on php4 myself and hence never bothered to check it on php4)

  46. where can i find this command line…??

    Run from command line:

    1. [email protected]:/jaxl$ sudo php index.php
    2. OSType: Linux, Registering shutdown for SIGINT and SIGTERM
    3. OpenSSL: Enabled for CLI
    4. Attempting DIGEST-MD5 Authentication…
    5. Starting Session…
    6. Requesting Feature List…
    7. Requesting Roster List…
    8. Setting Status…
    9. Done

  47. ildar, russia

    Hi! thanks for this library! i’ve some q’s, can you help me, plese? – i wanna use jaxl in my intranet jabber server – Openfire 3.6 + MySQL – can i get the result whith it? I just plan to send messages on some alerts to different users and thats all 🙂

  48. ravi

    hi ……
    thanks for reply.
    Actually i am new in php. I tried to connect jaxl to openfire but only long loading process is shown on browser.
    Because i want to know how it will connect so i did not include mysql.clas.php file and remove the variable related to it. But it is not working.
    index.php code is this:-

    echo ‘4’;
    /* Communicate with Jabber Server */
    while($jaxl->isConnected) {
    echo ‘5’;

  49. ravi

    //1 connect();
    //20 echo ‘4’;
    //21 /* Communicate with Jabber Server */
    //22 while($jaxl->isConnected) {
    //23 $jaxl->getXML();
    //24 echo ‘5’;
    //25 }
    “index.php” 32L, 706C

  50. Pingback: May 20th | Matthieu Bozec

  51. Seif

    Hey, i only know objective-c and i want to make a chat app for the iphone.

    Please tell me what i need to learn.
    I know XMPP, but do i need to know PHP/mySQL?

    What else, how do i have a server? please tell me in details.

  52. Hi Brother
    Firstly thanks for this library…
    I am totally new to XMPP. I want to built a chat application for my website. I have installed OPENFIRE XMPP server. So will this library help me to connect to this server and will i be able to make my own ONE TO ONE chat system on my website using this library.. please reply..


  53. I have solved above problem But now JSON response is

    [{“jaxl”:”curlError”,”code”:7,”msg”:”couldn’t connect to host”}]

    although i have enabled curl in my server..

    Log Message:

    [1:5460:0] 2011-03-01 13:53:55 – [[XMPPSend]] body

    [1:5460:0] 2011-03-01 13:53:56 – [[JAXL0124]] Curl errno 7 encountered. Failed to connect with http://localhost:5280/http-bind/

  54. FULL LOG with level 5

    [1:5460:0] 2011-03-01 15:55:20 – [[JAXL]] No callbacks for shutdown

    [1:5460:0] 2011-03-01 15:55:20 – [[JaxlAction]] connect

    [1:5460:0] 2011-03-01 15:55:20 – [[JAXL0124]] Loading session data
    {“uid”:11,”user_name”:”admin”,”gid”:”(1,2)”,”pid”:1,”csv_array”:{“headers”:[“Campaign Name”,”Date Sent”,”Comments”,”Sent To”,”Sent”,”Pending”,”Error”],”1″:[“Test”,”Mar 1 2011 12:00AM”,” “,100,0,100,0]},”jaxl_auth”:”connect”,”jaxl_sid”:”ea6d65a4″,”jaxl_rid”:2406}

    [1:5460:0] 2011-03-01 15:55:20 – [[JAXL]] Calling JAXL0206 method startStream

    [1:5460:0] 2011-03-01 15:55:20 – [[JAXL0124]] Not authed yet, Not commiting session
    {“uid”:11,”user_name”:”admin”,”gid”:”(1,2)”,”pid”:1,”csv_array”:{“headers”:[“Campaign Name”,”Date Sent”,”Comments”,”Sent To”,”Sent”,”Pending”,”Error”],”1″:[“Test”,”Mar 1 2011 12:00AM”,” “,100,0,100,0]},”jaxl_auth”:”connect”,”jaxl_sid”:”ea6d65a4″,”jaxl_rid”:2406}

    [1:5460:0] 2011-03-01 15:55:20 – [[XMPPSend]] body

    [1:5460:0] 2011-03-01 15:55:21 – [[JAXL]] Calling JAXL0206 method out

    [1:5460:0] 2011-03-01 15:55:21 – [[JAXL0124]] Curl errno 7 encountered. Failed to connect with http://localhost:5280/http-bind/

    [1:5460:0] 2011-03-01 15:55:21 – [[BoshOut]]
    [{“jaxl”:”curlError”,”code”:7,”msg”:”couldn’t connect to host”}]

  55. Parth

    Hi Abhishek,

    I have a big and long term project .On that I need to implement chat module .
    That may be one to one or multiuser .

    To achieve this I have installed Openfire as xmpp server and xmpphp as client to connect with openfire .This is working fine . Now I want to create and delete users from openfire using xmpphp .Users are creating but not able to delete the users . Each time I am getting internal server error though following the xmpp guideline .This is frustating me and looking for an alternate .
    After some searching I found about JAXL .
    Before moving to JAXL , could you give me
    pros and cons of JAXL over xmpphp .

    Thanks and Regards

  56. Vivek Shingala

    Hi, Abhi…

    This is such a great library to connect with jabber server. I’ve seen many comments and many articles of jaxl and tried code in my localhost using php. But its not working.

    So I want to know that only XAMPP is enough for this to work, or I need some other configuration to work with??

    Could you please provide step by step procedure for sendMessage example on windows OS??

    I run that example file in my command prompt(windows) like,

    C:xampphtdocsjaxl-1.0.4>php sendMessage.php vivek[email protected] hi

    but it returns the error like below,

    ‘php’ is not recognized as an internal or external command,
    operable program or batch file.

    I don’t understand this problem, please help me for this.


    1. parth

      Hi Vivek,
      The error is clearly stating that php is not a windows command .
      Since PHP is a third party software, to execute php as a command ,you need have 2 options.

      1. go to the directory where php is installed (in you case c:/xampp/php)

      2. make the php installation path as global command path by setting it in environment variables . To do this append your php path in the path setting of environment variables under system properties .


Comments are closed.