Query GSC Voice Server

From GSC Wiki

Jump to: navigation, search

Contents


The example code below will only work for a GSC 2.00 voice server.

The following example will query the GSC Help Voice Server (commonly referred to as the "GSC Lobby")

PHP example code

<?php
$fp = fsockopen("66.55.154.217", 8011, $errno, $errstr, 30);
if(!$fp)
{
	echo "$errstr ($errno)<br />\n";
}
else
{
	$out = "\x01\x00\x59\x01\x00\x00\x00\x04\x00\x00\x00\x00";

	fwrite($fp, $out);
	while(!feof($fp))
	{
		echo fgets($fp, 128);
	}

	fclose($fp);
}
?>


Example output

<channel>
 <name>GSC%20Voice%20Server</name>
 <owner>quon</owner>
 <security>false</security>
 <desc>Primary%20Voice%20Server</desc>
 <iconlocation></iconlocation>
 <forceptt>false</forceptt>
 <urllink></urllink>
 <phoneticname></phoneticname>
 <rooms>
  <room>
   <id>1</id>
   <name>Lobby</name>
   <security>false</security>
   <desc></desc>
   <forceptt>false</forceptt>
   <parentid>0</parentid>
   <displayorder>0</displayorder>
  </room>
  <room>
   <id>3</id>
   <name>AFK%28Gone%20for%20the%20night%29</name>
   <security>false</security>
   <desc></desc>
   <forceptt>false</forceptt>
   <parentid>4</parentid>
   <displayorder>0</displayorder>
  </room>
  <room>
   <id>4</id>
   <name>AFK%28Be%20back%20soon%29</name>
   <security>false</security>
   <desc></desc>
   <forceptt>false</forceptt>
   <parentid>0</parentid>
   <displayorder>4</displayorder>
  </room>
  <room>
   <id>11</id>
   <name>Pub</name>
   <security>false</security>
   <desc></desc>
   <forceptt>false</forceptt>
   <parentid>0</parentid>
   <displayorder>3</displayorder>
  </room>
  <room>
   <id>15</id>
   <name>GameServers%2ecom%20Staff</name>
   <security>true</security>
   <desc>Not%20GSC%20Staff</desc>
   <forceptt>true</forceptt>
   <parentid>0</parentid>
   <displayorder>1</displayorder>
  </room>
  <room>
   <id>16</id>
   <name>GSC%20Staff</name>
   <security>true</security>
   <desc></desc>
   <forceptt>true</forceptt>
   <parentid>0</parentid>
   <displayorder>2</displayorder>
  </room>
  <room>
   <id>17</id>
   <name>Verbal%20Darts</name>
   <security>false</security>
   <desc></desc>
   <forceptt>false</forceptt>
   <parentid>11</parentid>
   <displayorder>0</displayorder>
  </room>
  <room>
   <id>18</id>
   <name>Internet%20Drinking%20Games</name>
   <security>false</security>
   <desc></desc>
   <forceptt>false</forceptt>
   <parentid>11</parentid>
   <displayorder>1</displayorder>
  </room>
  <room>
   <id>19</id>
   <name>The%20Smoking%20Section</name>
   <security>false</security>
   <desc></desc>
   <forceptt>false</forceptt>
   <parentid>11</parentid>
   <displayorder>2</displayorder>
  </room>
 </rooms>
 <users>
  <user>
   <username>tellz</username>
   <nickname></nickname>
   <currroom>1</currroom>
   <privledged>false</privledged>
  </user>
  <user>
   <username>drworm</username>
   <nickname></nickname>
   <currroom>1</currroom>
   <privledged>false</privledged>
  </user>
 </users>
</channel>


NOTES: 1. The XML data returned is prepended by a 8 byte header. which can be safely ignored.

2. there is no XML file header but the following header can be prepended to generate correct XML.
<?xml version="1.0" encoding="UTF-8" ?>

Field Explanation (shown in C style syntax)

channel.name - URL Encoded name of the channel
channel.owner - GSC username of the channel owner
channel.security - "true" is protected "false" if public
channel.desc - URL Encoded description of the channel
channel.iconlocation - URL Encoded URL location of the channel icon
channel.forceptt - "true" if users must have "Push to Talk" enabled in order to join
channel.urllink - URL Encoded URL location of website associated with channel.
channel.phoneticname - URL Encoded phonetic name of the channel.
room.id - Numerical id of this room
room.name - URL Encoded name of the room
room.security - "true" if protected "false" if public to all users who can enter channel
room.desc - URL Encoded description of the room.
room.parentid - Numerical id of the parent room. 0 if no parent.
room.displayorder - Numerical id of the order in which it should be displayed (0 is drawn first)
user.username - GSC username of the user
user.nickname - URL Encoded nickname of the user
user.currroom - Numerical id of the room the user is currently in
user.privledged - "true" if the user has some administration access for the channel. "false" otherwise
Personal tools