else if ($line) == '')
$port = 10010; function getServerAPI($apiCommand) { global $port; $result = ""; $fp = fsockopen("localhost", $port, &$errno, &$errstr, 2); if (!$fp) { echo "$errstr ($errno)\n"; } else { fputs($fp,"GET /?".$apiCommand." HTTP/1.0\n\n"); $header = true; while(!feof($fp)) { $line = fgets($fp,128); if ($header == false AND ($line = trim($line)) != '') { $result .= "$line, "; } else if (trim($line) == '') { $header = false; } } fclose($fp); } return substr($result, 0, -2); // trim the last ', ' } $userCount = getServerAPI( "api.UserList" );$roomList = getServerAPI( "api.RoomList" );