if ($cmd[0] == 'vcard') { if (!$cmd[1]) { $cmd[1] = $conn->user . '@' . $conn->server; } // take a note which user requested which vcard $vcard_request[$pl['from']] = $cmd[1]; // request the vcard $conn->getVCard($cmd[1]); } break; case 'presence': print "Presence: {$pl['from']} [{$pl['show']}] {$pl['status']}\n"; break; case 'session_start': print "Session Start\n"; $conn->getRoster(); $conn->presence($status = "Cheese!"); break; case 'vcard': // check to see who requested this vcard $deliver = array_keys($vcard_request, $pl['from']); // work through the array to generate a message print_r($pl); $msg = ''; foreach ($pl as $key => $item) { $msg .= "{$key}: "; if (is_array($item)) { $msg .= "\n"; foreach ($item as $subkey => $subitem) { $msg .= " {$subkey}: {$subitem}\n"; }