Hi all,
I’m trying to retrieve the user (not in roster) presence via jQuery or PHP to dosplay in a webpage which user are online or not.
If I try to retrieve it by jQuery i get this error from Firebug:
GET http://saturno.ed:9090/plugins/presence/status?jid=##@domain&type=xml&_=1329907925328 200 OK 84ms
Ajax code is this:
$.ajax({
url: 'http://server.domain:9090/plugins/presence/status?jid=##@domain&type=xml',
async: false,
cache: false,
dataType: "text/xml",
success: function(data){ console.log('data: '+data);
}, //end success
error:function(xhr,err){
console.log("readyState: "+xhr.readyState+"\nstatus: "+xhr.status);
console.log("responseText: "+xhr.responseText);
}
});//end ajax
From console.log:
data: readyState: 4status: 0 responseText:
If i try to get presence from PHP with this code
$url = "http://server.domain:9090/plugins/presence/status?jid=##@domain&type=xml";
$str = file_get_contents($url);
i get this:
<presence type="error"><error code="403" type="auth"><forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></presence>
Where i wrong? How i can get via Ajax user’s presence?
Tkx to all!