I'm using XMPPHP to retrieve the roster of my application users GMail account.
Can XMPPHP also tell me the roster contacts online status?
I can't seem to find how to do that...
cheers.
I'm using XMPPHP to retrieve the roster of my application users GMail account.
Can XMPPHP also tell me the roster contacts online status?
I can't seem to find how to do that...
cheers.
I haven't tried it with Google Talk, but generally you're looking for
$roster->getPresence($jid)['status']
$uStatus = $conn->roster->getPresence($jid);
echo "Online status: " . $uStatus['show']; // tells whether available or unavailable or dnd
echo "Status message: " . $uStatus['status']; // shows the user's status message
I have the same problem: The presence array seems to be completely empty. None of these solutions works for me. Did you make it work?
This is my code (XMPPHP as library in Zend Framework):
$conn = new MyApp_XMPPHP_XMPP(SERVER, 5222, USERNAME, PASS, 'xmpphp');
try {
$conn->connect();
$conn->processUntil('session_start');
$conn->getRoster();
$conn->disconnect();
} catch(XMPPHP_Exception $e) {
die($e->getMessage());
}
$conn->roster looks like this:
Roster Object
(
[roster_array:protected] => Array
(
[USERNAME@JABBERSERVER] => Array
(
[contact] => Array
(
[jid] => USERNAME@JABBERSERVER
[subscription] => both
[name] =>
[groups] => Array
(
[0] => Kontakte
)
)
)
)
)