I
I
Ivan2017-01-29 08:48:00
In contact with
Ivan, 2017-01-29 08:48:00

Getting data on a VK token?

There is a request for messages.getHistory VK
With the help of it I receive VK messages, but there is a limit on the output of no more than 200 messages, how to fix this?
Well you got me

<?php
  $wall = file_get_contents("https://api.vk.com/method/messages.getHistory?access_token=1449c9f1a4ada4c78f00ab3859a924f2dcc2b773d43d08165cce62540eb248cc9b26ff55745f31b02a38f9&user_id=273876598&count=200&v=5.62"); // Отправляем запрос
  $wall = json_decode($wall); // Преобразуем JSON-строку в массив
  $wall = $wall->response->items; // Получаем массив комментариев
  for ($i = 0; $i < count($wall); $i++) {
    echo 
    "<p><b>"
    .($i + 1).
    "</b>. <i>"
    .$wall[$i]->body.
    "</i><br /><span>"
    .date("Y-m-d H:i:s", 
    $wall[$i]->date).
    "</span></p>"; // Выводим записи
  }
?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Zhilyaev, 2017-01-29
@kirill_782

use offset.
And read about the alternative syntax for control structures, and about the foreach loop

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question