PHP code example of teamspeakphp / web-query

1. Go to this page and download the library: Download teamspeakphp/web-query library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

teamspeakphp / web-query example snippets


$teamspeak = TeamSpeak::client('100.100.100.100:10080', 'my-api-key', 1);
$channels = $teamspeak->channels()->list()->channels;

foreach ($channels as $channel) {
    echo 'Found channel '.$channel->name.PHP_EOL;
}

$teamspeak = TeamSpeak::client('100.100.100.100:10080', 'my-api-key', 1);
$clients = $teamspeak->databaseClients()->list(limit: 100)->clients;

foreach ($clients as $client) {
    echo sprintf('Database client: %s (%s)', $client->nickname, $client->lastIpAddress);
}

$teamspeak = TeamSpeak::factory()
    ->withBaseUri('100.100.100.100:10080')
    ->withApiKey('my-api-key')
    ->withPort(9987)
    ->make();