Forum

Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    Join Date
    May 2015
    Location
    Brazil
    Posts
    12

    Question Simple REST API - Planet TeamSpeak end?

    I was using REST API to generate graphics from the server, unfortunately for some time the API is not working.

    Code:
    https://www.planetteamspeak.com/
    Is it over?
    Last edited by dante696; January 28th, 2019 at 02:55 PM. Reason: merged

  2. #17
    Join Date
    July 2018
    Location
    Dessau,Germany
    Posts
    46
    needed the ts3admin.class.php from her https://github.com/par0noid/ts3admin.class

    Code:
    <?PHP
    
    /*-------SETTINGS-------*/
    $ts3_ip = '127.0.0.1';
    $ts3_queryport = 10011;
    $ts3_user = 'serveradmin';
    $ts3_pass = 'yourpassword';
    /*----------------------*/
    
    #Include ts3admin.class.php
    require("ts3admin.class.php");
    
    #build a new ts3admin object
    $tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);
    
    if($tsAdmin->getElement('success', $tsAdmin->connect())) {
    	#login as serveradmin
    	$tsAdmin->login($ts3_user, $ts3_pass);
    	
    	#get serverlist
    	$servers = $tsAdmin->serverList();
    	
    	#set output var
    	$output = '';
    	
    	#generate table codes for all servers
    	foreach($servers['data'] as $server) {
    		$output .= '<tr bgcolor="#ffffff" onmouseover="style.backgroundColor=\'#eeeeee\'" onmouseout="style.backgroundColor=\'#ffffff\'">';
    		$output .= '<td width="50px" align="center">#'.$server['virtualserver_id'].'</td>';
    		$output .= '<td width="300px">&nbsp;&nbsp;'.htmlspecialchars($server['virtualserver_name']).'</td>';
    		$output .= '<td width="100px" align="center">'.$server['virtualserver_port'].'</td>';
    		if(isset($server['virtualserver_clientsonline'])) {
    			$clients = $server['virtualserver_clientsonline'] . '/' . $server['virtualserver_maxclients'];
    		}else{
    			$clients = '-';
    		}
    		$output .= '<td width="200px" align="center">'.$clients.'</td>';
    		$output .= '<td width="100px" align="center">'.$server['virtualserver_status'].'</td>';
    		if(isset($server['virtualserver_uptime'])) {
    			$uptime = $tsAdmin->convertSecondsToStrTime(($server['virtualserver_uptime']));
    		}else{
    			$uptime = '-';
    		}
    		$output .= '<td width="150px" align="center">'.$uptime.'</td>';
    	}
    }else{
    	echo 'Connection could not be established.';
    }
    
    if(count($tsAdmin->getDebugLog()) > 0) {
    	foreach($tsAdmin->getDebugLog() as $logEntry) {
    		echo '<script>alert("'.$logEntry.'");</script>';
    	}
    }
    
    ?>
    <html>
    <!DOCTYPE html>
    <html lang="en" class="no-js">
        <head>
    	    <meta charset="UTF-8">
        <meta name="viewport"
         content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
        <title>Document</title>
    	</header>
        <body>
        	<table bgcolor="#000000" cellpadding="5" cellspacing="1" width="900px" border="0" align="center">
            	<tr bgcolor="#c0c0c0">
                	<td width="50px" align="center"><b>ID<b></td>
                    <td width="300px" align="center"><b>Servername<b></td>
                	<td width="100px" align="center"><b>Port<b></td>
                	<td width="200px" align="center"><b>Current clients<b></td>
                    <td width="100px" align="center"><b>Status<b></td>
                    <td width="150px" align="center"><b>Uptime<b></td>
                </tr>
    			       <div class="container">
    
     	   
                <?PHP echo $output; ?>
    		
            </table>
        <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
    </body>
    </html>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 20
    Last Post: December 18th, 2011, 02:12 AM
  2. Replies: 2
    Last Post: July 15th, 2010, 09:28 AM
  3. Replies: 1
    Last Post: April 27th, 2010, 05:25 AM
  4. My experience on TS3 Server setup, including crashes
    By One-B in forum Server Support
    Replies: 2
    Last Post: December 22nd, 2009, 05:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •