'Unknown', 'AGENT_IDLE' => 'Idle', 'AGENT_ONCALL' => 'On Call', 'AGENT_LOGGEDOFF' => 'Not Logged In' ); if(!$socket) { print "Couldn't open socket. Error #" . $errornum . ": " . $errorstr; } else { fputs($socket, "Action: Login\r\n"); fputs($socket, "UserName: $username\r\n"); fputs($socket, "Secret: $secret\r\n\r\n"); fputs($socket, "Action: Agents\r\n\r\n"); fputs($socket, "Action: Logoff\r\n\r\n"); while(!feof($socket)) { $info = fscanf($socket, "%s\t%s\r\n"); switch($info[0]) { case "Agent:": $curr_agent = $info[1]; $agents[$curr_agent] = array(); break; case "Name:": $agents[$curr_agent]['Name'] = $info[1]; break; case "Status:": $agents[$curr_agent]['Status'] = $better_status[$info[1]]; break; case "LoggedInChan:": $agents[$curr_agent]['LoggedInChan'] = $info[1]; break; case "LoggedInTime:": if($info[1] != "0") { $agents[$curr_agent]['LoggedInTime'] = date("D, M d Y g:ia", $info[1]); } else { $agents[$curr_agent]['LoggedInTime'] = "n/a"; } break; case "TalkingTo:": $agents[$curr_agent]['TalkingTo'] = $info[1]; break; default: break; } } fclose($socket); print "
Agent # | Agent Name | Agent Location | Agent Status | Agent Talking To | Agent Login Time |
---|---|---|---|---|---|
" . $agent . " | \n"; print "" . $curr['Name'] . " | \n"; print "" . $curr['LoggedInChan'] . " | \n"; print "" . $curr['Status'] . " | \n"; print "" . $curr['TalkingTo'] . " | \n"; print "" . $curr['LoggedInTime'] . " | \n