$client_id = '5456066';
$scope = 'offline,audio';
$new_url = "https://oauth.vk.com/authorize?client_id=$client_id&display=page&redirect_uri=https://oauth.vk.com/blank.html&scope=$scope&response_type=token&v=5.37";
header('Location: '.$new_url);
<?php
$acces_token="ВАШ ТОКЕН";
$json = curl('https://api.vk.com/method/audio.get?user_id=432067845&need_user=0&count=1000&offset=0&access_token='.$acces_token.'&v=5.62');
$st = json_decode($json, true);
function curl($url)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, "Opera/10.00 (Windows NT 5.1; U; ru) Presto/2.2.0");
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);
return $response;
}
?>
<pre style="word-wrap: break-word; white-space: pre-wrap;">"<?var_dump($st);?>"</pre>
"array(1) {
["response"]=>
array(2) {
["count"]=>
int(402)
["items"]=>
array(402) {
[0]=>
array(9) {
["artist"]=>
string(6) "Nightw"
["id"]=>
int(456239432)
["owner_id"]=>
int(432067845)
["title"]=>
string(4) "Nemo"
["duration"]=>
int(252)
["url"]=>
string(215) "https://cs1-45v4.vkuseraudio.net/p2/9c3c6654a468fd.mp3?extra=cbBG75YV6dLWboAy2ivlkklMCbKNviF4z95IZWlK7TpwiEnXALnkw-13EqfZ4NSIf_xbCQEB3N7scfzjonXB4GJX18B5o8LY4GS2LX4A3lbVavX1SJauybkthVfhOQgldwot2EKc-9eYibDiKBfc44KrtQ"
["date"]=>
int(1561649986)
["lyrics_id"]=>
int(328418204)
["genre_id"]=>
int(1001)
}
[1]=>
array(9) {
["artist"]=>
string(6) "ZHIEND"
["id"]=>
int(456239431)
["owner_id"]=>
int(432067845)
["title"]=>
string(9) "End Of Me"
["duration"]=>
int(170)
["url"]=>
string(216) "https://cs1-61v4.vkuseraudio.net/p12/bca599ff0e25c5.mp3?extra=iMCE7xrX48HOh8cuXdDvkgSRXOUFsB8307AIXJV-K_U0ayzfUJazn2sEhgGsxTEecgHmrGCpI_STpoLGxPDUvFseDyf0nFDaj5GCqgMeXLN7Stq_KNXvxfURJe9cEp4YSm-mISAUAznipyVZ9EoK37WhOw"
["date"]=>
int(1561649978)
["lyrics_id"]=>
int(282117518)
["genre_id"]=>
int(18)
}
[2]=>
array(8) {
["artist"]=>
string(9) "Cheshires"
["id"]=>
int(456239430)
["owner_id"]=>
int(432067845)
["title"]=>
string(10) "Север"
["duration"]=>
int(258)
["url"]=>
string(216) "https://cs1-75v4.vkuseraudio.net/p12/2519f68c4a4b87.mp3?extra=QEseP5BZEUUsvCOfgdsR_u5hCCaCFsQoVTyNx7EojL0cM5TWUVKqKxHLyZ-NLJfPsati4TczyVsfSM003HDHkVrZ0XYx4HpPGjp56_eByOFi5gNZXV7q5OY4Qb8w0SRyy4Bb5vDBL7LKWaGpM56fN2QFNA"
["date"]=>
int(1561649908)
["genre_id"]=>
int(7)
}
[3]=>
array(7) {
["artist"]=>
string(7) "3D Stas"
["id"]=>
int(456239429)
["owner_id"]=>
int(432067845)
["title"]=>
string(41) "Modern Hell (Original Mix) (Original Mix)"
["duration"]=>
int(312)
["url"]=>
string(216) "https://cs1-38v4.vkuseraudio.net/p20/75bb5a435cf090.mp3?extra=xx8pQcjSlqfEAmtmwmP1U3xshE8y1LW3SR2jlaHPsNHvzpuUmmGx2ajvgN2hFva8uUZEvEG8M2HDVg9Upw4MPoCK3B5BVb6FwhheBZX920aKugnboU7PETTaIwsyzYJAwomvh0VnV9nGzOmFpLyPbAM03Q"
["date"]=>
int(1557888822)
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>VK API</title>
<style>
ul {
list-style: none;
}
li {
margin-bottom: 15px;
}
a {
text-decoration: none;
color: #000;
display: flex;
align-items: center;
}
h4 {
margin: 0;
}
img {
border-radius: 50%;
width: 100px;
height: 100px;
margin-right: 20px;
}
</style>
</head>
<body>
<ul></ul>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
$(loadFriends);
function getUrl(method, params) {
if (!method) throw new Error('Вы не указали метод!');
params = params || {};
params['access_token'] = 'ВАШ ТОКЕ';
return 'https://api.vk.com/method/' + method + '?' + $.param(params)+'&v=5.80';
}
function sendRequest(method, params, func) {
$.ajax({
url: getUrl(method, params),
method: 'GET',
dataType: 'JSONP',
success: func
});
}
function loadFriends() {
sendRequest('users.get' ,{ fields: 'photo_100,online,'},
function (data) {
if (!!data.response) {
drawFriends(data.response);
}
if (!!data.error) { console.log(data.error['error_msg']); }
});
}
function drawFriends(friends) {
var html = '';
for (var i = 0; i < friends.length; i++) {
var f = friends[i];
var on = f.online;
var online = f.online ? 'Online' : 'Offline';
console.log (f.id,f.first_name,f.last_name,f.photo_100);
if(on == 1){
var status = "Компьютер";
}
html +=
'<li>'+
'<a target="_blank" href="https://vk.com/id'+ f.id +'">'
+'<img src="'+f.photo_100+'" />'
+'<div>'
+'<h4>' + f.first_name + ' ' + f.last_name + '</h4>'
+'<p>'+online+'</p>'
+'<p>'+status+'</P>'
+'<button>Написать</button>'
+'</div>'
+'</a>'
+'</li>';
}
$('ul').html(html);
}
</script>
</body>
</html>
var mass =[[1,"Андроид","http://site.ru"],[1,"Комп","http://site.ru"]];