Circleus Posted May 7, 2017 Share Posted May 7, 2017 So I found this link off from the game in my internet traffic. https://d26ly0au0tyuy.cloudfront.net/ When you go in the link, you will see it in the XML format. Each key in there can be use as URL path. Like https://d26ly0au0tyuy.cloudfront.net/lobbyListings.json.gz lobbyListings.json.gz is the first key in that XML format.What exactly this do? This will show you the list of the lobby information that running in DST (Its in JSON format). You can use it as API for your website or program. For web developer, you know what to do with json. Self explanatory...NOTE: I'm not sure if klei allow this. Klei, if you are reading this and you don't allow that link to be public, you may remove this topic. Link to comment Share on other sites More sharing options...
CarlZalph Posted May 7, 2017 Share Posted May 7, 2017 @Circleus It's allowed, and there's another mirror hosted at: http://s3.amazonaws.com/lobbylistings/lobbyListings.json.gz Link to comment Share on other sites More sharing options...
Bizzi Posted May 8, 2017 Share Posted May 8, 2017 DST-Servers connecting to Klei and say "Here, i'm online!". Klei stores the server, so you can find this server in your game. If you want to fetch more informations about the server (online players, enabled mods,..) you must create an seperate POSt-Request to the Lobby-Server: Spoiler <?php class Lobby { private $game = 'DontStarveTogether'; private $lobby_server = 'https://lobby.c.kleientertainment.com/'; private $lobby_list = 'https://d26ly0au0tyuy.cloudfront.net/lobbyListings.json.gz'; private $cache = NULL; public function getServers($update = false) { if(empty($this->cache)) { $servers_zip = file_get_contents($this->lobby_list); $servers_raw = gzdecode($servers_zip); $json = json_decode($servers_raw); $this->cache = $json->GET; } return $this->cache; } public function getServerByIndex($index) { $servers = $this->getServers(); return $servers[$index]; } public function getServerByID($id) { $servers = $this->getServers(); $server = NULL; foreach($servers AS $index => $entry) { if($entry->host == $id) { $server = $entry; break; } } return $server; } public function getServerDetails($server) { /* The $token will be generated in binary-format, saved ad Base64. I don't know, how will be generated. I think, it's a input validation of requested data. Possible Methods on Client-EXE: - ValidateToken - GetToken - TokenPurpose - HasAuthToken - GenerateClusterToken See also: - TheNet:GetServerModNames */ $token = base64_encode('DONT_KNOW_HOW_THE_TOKEN_WILL_GENERATED'); return $this->query($server->v, [ '__gameId' => $this->game, '__token' => 'pcl-usc^' . $server->host . '^' . $this->game . '^' . $token, 'query' => [ '__rowId' => $server->__rowId ] ]); } private function query($version, $query) { $http = curl_init(); curl_setopt($http, CURLOPT_URL, $this->lobby_server); curl_setopt($http, CURLOPT_POST, true); curl_setopt($http, CURLOPT_HEADER, true); curl_setopt($http, CURLOPT_POSTFIELDS, json_encode($query)); curl_setopt($http, CURLOPT_HTTPHEADER, [ 'User-Agent: ' . $this->game . '/' . $version, 'Accept-Encoding: deflate, gzip', 'Accept: application/json', 'Content-Type: application/json; charset=UTF-8' ]); curl_setopt($http, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($http); $header = curl_getinfo($http); curl_close($http); return [ 'header' => $header, 'response' => $response ]; } } ?> Sample $lobby = new Lobby(); $servers = $lobby->getServers(); print('<h1>Server List</h1>'); printf('<pre>%s</pre>', print_r($servers, true)); print('<h1>Server by Index</h1>'); printf('<pre>%s</pre>', print_r($lobby->getServerByIndex(100), true)); print('<h1>Server by ID</h1>'); printf('<pre>%s</pre>', print_r($lobby->getServerByID('KU_B9m7kaOz'), true)); print('<h1>Server Details</h1>'); printf('<pre>%s</pre>', print_r($lobby->getServerDetails($lobby->getServerByID('KU_B9m7kaOz')), true)); Link to comment Share on other sites More sharing options...
Circleus Posted May 9, 2017 Author Share Posted May 9, 2017 21 hours ago, Bizzi said: DST-Servers connecting to Klei and say "Here, i'm online!". Klei stores the server, so you can find this server in your game. If you want to fetch more informations about the server (online players, enabled mods,..) you must create an seperate POSt-Request to the Lobby-Server: Interesting class there I converted the PHP into nodejs I'm not sure if you should be using SSL for the lobby link or not (http://lobby.c.kleientertainment.com/) But with the SSL, I keep getting 404 Without the SSL, it just taking too long to response EDIT: Seem like it require SSL Link to comment Share on other sites More sharing options...
Bizzi Posted May 9, 2017 Share Posted May 9, 2017 All requests are over HTTPs. You can try to sniff the originals over Charles or other. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.