View Full Version : Remote add Server - PHP possible?
JasonOlsen
06-07-2008, 04:37
Hi,
I am using libacts2 for a lot of things like editing the server name etc through my own control panel I have for some people.
However, I want to make it so I can create a sub server, preferably in PHP, with given variables.
Is this possible in libacts2? I had a look at the source code, but couldn't see anything for making an actual sub server. If not possbile in libacts2, is it possible another way. I just need a function to do it but am unable to find anything. I found a few things but its in german and page translators haven't been much help.
Thanks for your help all,
Jason
Yes:
http://libacts2.absurdcoding.org/manual/libacts2/Absurd_TeamSpeak2_Host.html#methodcreateServer
JasonOlsen
06-07-2008, 17:00
Thanks Claw, I can't believe I missed half of the docs out. Skimmed past it in a rush heh.
Jason
JasonOlsen
08-07-2008, 22:50
What is wrong with this script?
I want to create a server, which works, and then create a server admin user on it with a particular path. The problem is that I can't create the user. I get an exception message saying server not selected. How would I select the server using the port other than the method below?
$server_port is correct and holds the port. It makes the server on that port so I assume it works.
// Connect and Login - Works
$host = Absurd_TeamSpeak2::connect('tcp://127.0.0.1:51234');
$host->login('superadmin', '**PASSWORD**');
// Create the server - Works
$host->createServer($server_port);
// Allow a pause in the script for the server to be made before adding the user
sleep(1);
//Create new registered user account (THIS IS WHERE ERROR APPEARS)
$host->getServerByUdp($server_port)->registerAccount('admin', '**PASSWORD**');
Error says..
Fatal error: Uncaught exception 'Absurd_TeamSpeak2_Exception' with message 'ERROR, no server selected' in /var/www/html/client/teamspeak/Absurd/TeamSpeak2/TCPClient.php
maxi1990
08-07-2008, 22:54
After adding a server you have to start it before you can select it in order to add users or whatever you wanna do.
JasonOlsen
09-07-2008, 03:08
Hi Maxi, that seems to have done the trick! :)
Thanks for your help. I'm just trying to write the max users to the server.
$http = Absurd_TeamSpeak2::httpConnect('tcp://localhost:14534');
$http->login($teamspeak_user, $teamspeak_password,$server_port);
$http->writeServerSettings(array('servername' => $server_name));
$http->writeServerSettings(array('servermaxusers' => $server_slots));
$http->writeServerSettings(array('serverpassword' => $server_pass));
The servername and password write fine, but the max users doesn't. I've checked the variable im writing to as servermaxusers from the original Teamspeak web interface port.
the $server_slots variable works, i've echo'd it and it shows the right value.
I believe it isn't writing because it is authenticated through the normal admin, not superadmin. Normal admin's cannot change the ports, so I assume there is some check in the Teamspeak server checking if it is a superadmin changing the maximum users. Is there a way I can write to the settings without logging in as that individual admin for that server? I've played around with different methods of selecting the server then writing without logging in etc, but doing that I got errors like:
Fatal error: Call to undefined method Absurd_TeamSpeak2_Server::writeServerSettings()
So, is there a way to write to the settings without logging in as the client?
Once again thanks for your help, it is much appreciated.
Jason
You can also change the values through the tcp server (which is also faster)
You just need to be logged in as an superadmin.
http://libacts2.absurdcoding.org/manual/libacts2/Absurd_TeamSpeak2_Server.html#methodsetValue
fogjuice
27-09-2008, 09:09
I am having a similar problem.
I'm trying to connect from one server to another with absurd but I keep getting the following error:
"Fatal error: Uncaught exception 'Absurd_Network_Exception' with message 'Connection refused'"
The same script works on the local server but when I use it from another remote server, the connection is refused.
As far as I know the port isn't blocked because I can connect to it from this computer.
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.