Answer the question
In order to leave comments, you need to log in
Does not display a list of comments VK API PHP, how to do?
Here is my code for displaying comments.
$gid = $_GET['gid'];
$pid = $_GET['pid'];
$api = file_get_contents("https://api.vk.com/method/wall.getComments?owner_id=-".$gid."&post_id=".$pid."&access_token=".$token."&count=10&v=5.58");
$wall = json_decode($api,true);
foreach ($wall['response'] as $items => $result) {
echo $result['text'];
}
Array
(
[response] => Array
(
[count] => 7
[items] => Array
(
[0] => Array
(
[id] => 174664
[from_id] => 103055504
[date] => 1530022656
[text] => Это где, кто знает?
)
[1] => Array
(
[id] => 174667
[from_id] => 52254070
[date] => 1530023698
[text] => [id103055504|Артур], Опук
[reply_to_user] => 103055504
[reply_to_comment] => 174664
)
[2] => Array
(
[id] => 174668
[from_id] => 103055504
[date] => 1530023736
[text] => [id52254070|Евгений], спасибо
[reply_to_user] => 52254070
[reply_to_comment] => 174667
)
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