I was using REST API to generate graphics from the server, unfortunately for some time the API is not working.
Is it over?Code:https://www.planetteamspeak.com/![]()
We are migrating towards a new forum system located at community.teamspeak.com, as such this forum will become read-only on January 29, 2020
I was using REST API to generate graphics from the server, unfortunately for some time the API is not working.
Is it over?Code:https://www.planetteamspeak.com/![]()
Last edited by dante696; January 28th, 2019 at 02:55 PM. Reason: merged
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"> '.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>
There are currently 1 users browsing this thread. (0 members and 1 guests)