S
S
Serge_iRig2018-10-27 20:30:58
PHP
Serge_iRig, 2018-10-27 20:30:58

How to display comments from VK discussions on a WordPress site?

People, hello everyone, you need to remove comments from the discussion topic (there are a lot of reviews in the VK group) VK to the site. I found several ways on the Internet: they all come down to the VK API ( https://vk.com/dev/board.getComments), because There is no specialized widget for such purposes. Created the following query:

<?php

$request_params = [
'group_id' => '92457343',
    'topic_id' => '32000957',
'need_likes' => 1,
'offset' => 0,
'count' => 100,
'extended' => 1,
'sort' => 'desc',
    'version' => 5.87,
'access_token' => '***'

];

$url = "https://api.vk.com/method/board.getComments?" . http_build_query($request_params);

$result = file_get_contents($url);
echo $result;

?>

Everything outputs (received data in JSON format), and now how to display the received data on the page of the Word Press website?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vova, 2019-01-05
@vova87

As an option:
1. Create a php template for the page
2. Parse the JSON array in this template using curl
3. Display everything in the right form.

R
Roman, 2019-04-25
Anonymous @roman9891

good day to all, there are a number of ready-made solutions for such tasks, so as not to pick api, for example 42app.ru there is free access, if you need to upload comments, that’s it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question