Answer the question
In order to leave comments, you need to log in
file() function not working?
Hello everyone!)
Please tell me, I need to show the authorized user 5 of his friends, for this I wrote the following code:
<?php
$url = 'https://oauth.vk.com/authorize?client_id=ХХХХХХХ&display=popup&scope=friends,offline&redirect_uri=http://мойсайт&response_type=code&v=5.92' ;
$code = $_GET['code'];
$url = 'https://oauth.vk.com/access_token?client_id=ХХХХХХХ&client_secret=секрет&code='.$code.'&redirect_uri=http://мой сайт';
$result = file_get_contents($url);
$result = json_decode($result, true);
$access_token = $result['access_token'];
$url = 'https://api.vk.com/method/friends.get?user_id=&order=random&count=5&fields=nickname, photo_50&access_token='.$access_token.'&v=5.92';
$data = file_get_contents($url);
$data = json_decode($data, true);
var_dump ($data);
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question