VK Audio API reference for VK Audio Token
Index
API Methods
General info
New API Methods

audio.get

Get audios for a specified user, community or playlist

Parameters:

NameValue
owner_id (optional)User or community id (for example, obtained by users.get)
album_id (optional)Playlist id (for example, obtained by audio.getPlaylists)
count (optional)Maximum number of audios to return
offset (optional)Offset to skip that number of audios
access_keyMay be needed when owner_id starts with "-" (for example, when using audio.searchAlbums method)

If both owner_id and album_id are not specified, this method returns current user audios (for which the token was obtained)

Example — getting current user audios (Kate):

curl_setopt(
$ch,
CURLOPT_URL,
"https://api.vk.com/method/audio.get?access_token=".TOKEN."&count=10&v=5.95"
);
<?php
include __DIR__.'/../../autoloader.php';
use Vodka2\VKAudioToken\SupportedClients;
//Token obtained by example_microg.php script
define('TOKEN', $argv[1]);
define('USER_AGENT', SupportedClients::Kate()->getUserAgent());
$ch = curl_init();
curl_setopt($ch,CURLOPT_HTTPHEADER, array('User-Agent: '.USER_AGENT));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt(
$ch,
CURLOPT_URL,
"https://api.vk.com/method/audio.get?access_token=".TOKEN."&count=10&v=5.95"
);
echo json_encode(json_decode(curl_exec($ch)), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)."\n\n";

Example — getting audios of arbitrary user (Kate):

$ownerId = 238615607;
curl_setopt(
$ch,
CURLOPT_URL,
"https://api.vk.com/method/audio.get?access_token=".TOKEN."&owner_id=$ownerId&count=10&v=5.95"
);
<?php
include __DIR__.'/../../autoloader.php';
use Vodka2\VKAudioToken\SupportedClients;
//Token obtained by example_microg.php script
define('TOKEN', $argv[1]);
define('USER_AGENT', SupportedClients::Kate()->getUserAgent());
$ch = curl_init();
curl_setopt($ch,CURLOPT_HTTPHEADER, array('User-Agent: '.USER_AGENT));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$ownerId = 238615607;
curl_setopt(
$ch,
CURLOPT_URL,
"https://api.vk.com/method/audio.get?access_token=".TOKEN."&owner_id=$ownerId&count=10&v=5.95"
);
echo json_encode(json_decode(curl_exec($ch)), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)."\n\n";

Example — getting playlist of arbitrary user (Kate):

$ownerId = 238615607;
$albumId = 1;
curl_setopt(
$ch,
CURLOPT_URL,
"https://api.vk.com/method/audio.get?access_token=".TOKEN."&owner_id=$ownerId&album_id=$albumId&count=10&v=5.95"
);
<?php
include __DIR__.'/../../autoloader.php';
use Vodka2\VKAudioToken\SupportedClients;
//Token obtained by example_microg.php script
define('TOKEN', $argv[1]);
define('USER_AGENT', SupportedClients::Kate()->getUserAgent());
$ch = curl_init();
curl_setopt($ch,CURLOPT_HTTPHEADER, array('User-Agent: '.USER_AGENT));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$ownerId = 238615607;
$albumId = 1;
curl_setopt(
$ch,
CURLOPT_URL,
"https://api.vk.com/method/audio.get?access_token=".TOKEN."&owner_id=$ownerId&album_id=$albumId&count=10&v=5.95"
);
echo json_encode(json_decode(curl_exec($ch)), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)."\n\n";