F
F
felony13twelve2020-09-19 00:57:35
PHP
felony13twelve, 2020-09-19 00:57:35

How to get a link to an mp3 file?

Goodnight! There is this code

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);

$query = "Justin Bieber - Baby";

curl_setopt(
    $ch,
    CURLOPT_URL,
    "https://api.vk.com/method/audio.search?access_token=".TOKEN.
    "&q=".urlencode($query)."&count=10&v=5.95"
);

echo json_encode(json_decode(curl_exec($ch)),

How to get a link to an mp3 file?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
HemulGM, 2020-09-19
@felony13twelve

You need to request an audio recording via audio.get

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question