Permalink
Browse files

working example of http_bind.php

  • Loading branch information...
1 parent 34a6c5a commit eb6a4e141f1bdd27ee7279ad91c8070d6ea8c4ba @abhinavsingh abhinavsingh committed Oct 5, 2012
Showing with 17 additions and 7 deletions.
  1. +17 −7 examples/http_bind.php
View
@@ -36,21 +36,31 @@
*
*/
-// backward compatibility example
-// for developers who were using JAXL directly via browsers
-// through ajax calls (probably by using distributed jaxl.js)
-// Yet not working, keep an eye on this example file
+if(!isset($_GET['jid']) || !isset($_GET['pass'])) {
+ echo "invalid input";
+ exit;
+}
//
// initialize JAXL object with initial config
//
-require_once 'jaxl.php';
-$bosh = new JAXL();
+require_once '../jaxl.php';
+$client = new JAXL(array(
+ 'jid' => $_GET['jid'],
+ 'pass' => $_GET['pass'],
+ 'bosh_url' => 'http://localhost:5280/http-bind',
+ 'log_level' => JAXL_DEBUG
+));
+
+$client->add_cb('on_auth_success', function() {
+ global $client;
+ _info("got on_auth_success cb, jid ".$client->full_jid->to_string());
+});
//
// finally start configured xmpp stream
//
-//$bosh->start();
+$client->start();
echo "done\n";
?>

0 comments on commit eb6a4e1

Please sign in to comment.