PHP code example of pbxapi / xmpp-php

1. Go to this page and download the library: Download pbxapi/xmpp-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pbxapi / xmpp-php example snippets



        use Pbxapi\XmppPrebind; 

        $params = [
            "user" => "john",
            "password" => "johnspass",
            "tld" => "domain.com",
            "boshUrl" => "<bosh-url-of-your-xmpp-server>" 
            //For openfire it's something like http://<your-xmpp-fqdn>:7070/http-bind/
        ];
        $xmpp = new XmppPrebind($params);
        echo json_encode($xmpp->connect()); //will return JID, SID, RID as JSON