I am implementing the Facebook Chat into my site so I used JAXL in order to implement the XMPP. It seems that the script posts the message that I wanted, but whenever I run it, the page just keeps loading and loading and never stops. In order to get back onto that site, I have to clear the cookies for it in my browser. Not sure what the problem could be, I am not seeing any errors in my log. Take a look at the code: Thanks!
$client = new JAXL(array(
'jid' => $user['facebookID']."@chat.facebook.com",
'fb_app_key' => "XXXX",
'fb_access_token' => $user['facebook_access_token'],
'force_tls' => true,
'auth_type' => 'X-FACEBOOK-PLATFORM',
'log_level' => JAXL_INFO,
'priv_dir' => "includes/lib/jaxl/tmp"
));
$client->add_cb('on_auth_success', function() {
global $client;
_info("got on_auth_success cb, jid ".$client->full_jid->to_string());
$client->set_status("available!", "dnd", 10);
$msg = new XMPPMsg(array('to'=>'-XXXX@chat.facebook.com'), 'test message');
$client->send($msg);
});
$client->add_cb('on_auth_failure', function($reason) {
global $client;
$client->send_end_stream();
_info("got on_auth_failure cb with reason $reason");
});
$client->add_cb('on_chat_message', function($stanza) {
global $client;
// echo back incoming message stanza
$stanza->to = $stanza->from;
$stanza->from = $client->full_jid->to_string();
$client->send($stanza);
});
$client->add_cb('on_disconnect', function() {
_info("got on_disconnect cb");
});
//
// finally start configured xmpp stream
//
$client->start();
echo "done";