What is the purpose of using fsockopen in PHP for creating Tokens in Teamspeak 3?

When creating Tokens in Teamspeak 3 using PHP, the fsockopen function is used to establish a connection to the Teamspeak 3 server in order to send requests and receive responses. This allows the PHP script to interact with the Teamspeak 3 server and generate Tokens for authentication and authorization purposes.

<?php
$serverAddress = 'your_teamspeak_server_address';
$serverPort = 10011;

$socket = fsockopen($serverAddress, $serverPort, $errno, $errstr, 30);
if (!$socket) {
    die("Error: $errstr ($errno)");
}

// Your code to send requests and receive responses to create Tokens goes here

fclose($socket);
?>