Open GoogleCodeExporter opened 8 years ago
I also can`t get the firends list. any body can help me ?
Original comment by lucky.zh...@gmail.com
on 13 Jun 2012 at 7:37
From this code you will get Roster information of your friends
<?php
include 'XMPP.php';
function array_contactos($user,$pass){
#Use XMPPHP_Log::LEVEL_VERBOSE to get more logging for error reports
#If this doesn't work, are you running 64-bit PHP with < 5.2.6?
$conn = new XMPPHP_XMPP('talk.google.com', 5222, $user,$pass, "xmpphp", 'gmail.com', $printlog=false, $loglevel=XMPPHP_Log::LEVEL_INFO);
$conn->autoSubscribe();
$vcard_request = array();
try {
$conn->connect();
while(!$conn->isDisconnected()) {
$payloads = $conn->processUntil(array('end_stream', 'session_start','roster_received'));
foreach($payloads as $event) {
$pl = $event[1];
switch($event[0]) {
case 'session_start':
// print "Session Start\n";
$conn->getRoster();
$conn->presence($status="Cheese!".time());
print_r($p1);
break;
case 'roster_received':
$array_contactos=$pl;
return $array_contactos;
/*
foreach($array_contactos as $user => $mostrar_nombre){
echo $user.'<br>';
echo $mostrar_nombre['name'];
echo '<hr>';
}*/
$conn->disconnect();
break;
}
}
}
} catch(XMPPHP_Exception $e) {
die($e->getMessage());
}
}
$user_="xxxxxxxxxxxxxx";
$pass_='xxxxxxxxxxxxxx';
$results= array_contactos($user_,$pass_);
echo "<pre>";
print_r($results);
echo "</pre><br><br>";
foreach($results as $users => $mostrar_name){
echo $users.'<br>';
echo $mostrar_name['name'];
echo '<hr>';
}
Original comment by jay.vinf...@gmail.com
on 4 Jul 2012 at 5:42
Original issue reported on code.google.com by
tariqm...@gmail.com
on 21 Jun 2011 at 7:30