Channels Via web

EscuderoKevin

Well-Known Member
Jul 2, 2015
380
181
130
PHP:
<?php

/**
* Channel Create Example
* ----------------------
* Creating channels is very easy using the TeamSpeak 3 PHP Framework. Simply call the appropriate method and provide
* an associative array containing all the properties you want.
*
* Creating new virtual servers is working the same way.
*/

/* load framework library */
require_once("../libraries/TeamSpeak3/TeamSpeak3.php");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
  <title>Channel Create Example | TeamSpeak 3 PHP Framework <?= TeamSpeak3::LIB_VERSION; ?></title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body style="font-family: tahoma, arial, verdana, helvetica, sans-serif; font-size: 14px;">

<?php

try
{
  /* connect to server, login and get TeamSpeak3_Node_Server object by URI */
  $ts3_VirtualServer = TeamSpeak3::factory("serverquery://127.0.0.1:10011/?server_port=9987");

  /* create semi-perm channel and get new ID */
  echo "Creating first temporary channel on virtual server " . $ts3_VirtualServer . " ... ";
  $cid1 = $ts3_VirtualServer->channelCreate(array(
    "channel_name" => "My Channel",
    "channel_topic" => "This is my first channel...",
  ));
  echo "Done (ID " . $cid1 . ")<br />\n";

  /* create temp sub-channel and get new ID */
  echo "Creating first temporary sub-channel on virtual server " . $ts3_VirtualServer . " ... ";
  $cid2 = $ts3_VirtualServer->channelCreate(array(
    "channel_name" => "My Sub-Channel",
    "channel_topic" => "This is my second channel...",
    "cpid" => $cid1,
  ));
  echo "Done (ID " . $cid2 . ")<br />\n";

  /* create temp sub-channel and get new ID */
  echo "Creating second temporary sub-channel on virtual server " . $ts3_VirtualServer . " ... ";
  $cid3 = $ts3_VirtualServer->channelCreate(array(
    "channel_name" => "My Sub-Sub-Channel",
    "channel_topic" => "This is my third channel...",
    "cpid" => $cid2,
  ));
  echo "Done (ID " . $cid3 . ")<br />\n";
}
catch(Exception $e)
{
  echo "Error (ID " . $e->getCode() . ") <b>" . $e->getMessage() . "</b>";
}

?>

</body>

</html>

You can add FORM PHP for Dates , EX

channel_order => "ID CHANNEL"
channel_flag_permanent=> "true" (you can add Semi_Permanent and unse JTS3Servermod For delete in x days.)
Thats its for create channel in specific seccion..
 

Peralta00

Member
Feb 17, 2016
8
0
35
can you help me here the script is giving me this error

LOG:
PHP Fatal error: Uncaught exception 'TeamSpeak3_Transport_Exception' with message 'php_network_getaddresses: getaddrinfo failed: Name or service not known' in /var/www/channelcreator/TeamSpeak3/Transport/TCP.php:54
Stack trace:
#0 /var/www/channelcreator/TeamSpeak3/Transport/TCP.php(108): TeamSpeak3_Transport_TCP->connect()
#1 /var/www/channelcreator/TeamSpeak3/Adapter/ServerQuery.php(76): TeamSpeak3_Transport_TCP->readLine()
#2 /var/www/channelcreator/TeamSpeak3/Adapter/Abstract.php(60): TeamSpeak3_Adapter_ServerQuery->syn()
#3 /var/www/channelcreator/TeamSpeak3/TeamSpeak3.php(320): TeamSpeak3_Adapter_Abstract->__construct(Array)
#4 /var/www/channelcreator/channelcreator.php(107): TeamSpeak3::factory('serverquery://s...')
#5 {main}
thrown in /var/www/channelcreator/TeamSpeak3/Transport/TCP.php on line 54


PRINT :
kNMcPcx.png
 

ehthe

Retired Staff
Contributor
Apr 26, 2015
1,029
896
216
From your error : The domain that you entered for the serverquery does not resolve.
 

Neillx

Member
Oct 5, 2015
13
0
33
it would be nice if it worked but gives errors 500 all the time and the chanel name and subchanel name are wrong . with 5 caracteres dont let you create channels
 
Top