planetteamspeak / ts3phpframework

Modern use-at-will framework that provides individual components to manage TeamSpeak 3 Server instances
https://www.planetteamspeak.com
GNU General Public License v3.0
211 stars 59 forks source link

Get latest server version string #53

Closed Sebbo94BY closed 6 years ago

Sebbo94BY commented 6 years ago

I want to get the latest published server version as string like 3.0.13.8.

To archive this, I thought, this code is the correct one:

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

// connect to default update server
$ts3_UpdateServer = TeamSpeak3::factory("update");

echo "Latest Version: " . $ts3_UpdateServer->getServerVersion();

But, it returns 3.0.10.1. Which version is this? Why doesn't it return 3.0.13.8?

ronindesign commented 6 years ago

Let me check on this and get back to you.

svenpaulsen commented 6 years ago

The TeamSpeak update server only returns the last server version with protocol compatibility. To query the latest versions the easy way use these URLs:

https://www.teamspeak.com/versions/client.json https://www.teamspeak.com/versions/server.json

In addition, the TeamSpeak3_Adapter_Update class is deprecated. New clients fetch their update information from https://versions.teamspeak.com/ts3-client-2 which is a binary file containing data serialized with Protocol Buffers.

Sebbo94BY commented 6 years ago

@svenpaulsen can you maybe add a function to your framework to get the versions from these JSON files? This would be great.

svenpaulsen commented 6 years ago

I don't think there's a need to do that. Basically, it's as simple as this:

$versions = json_decode(file_get_contents('https://www.teamspeak.com/versions/server.json'));

echo $versions->linux->x86_64->version;
Sebbo94BY commented 6 years ago

Mhmm, ok. Then I'll just use json_decode(). Thx.