Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $token = "Тут токен";
- $request_params = array(
- 'offset' => 0,
- 'count' => 1,
- 'access_token' => $token,
- 'v' => '5.101'
- ); $json = json_decode(file_get_contents('https://api.vk.com/method/messages.getConversations?'. http_build_query($request_params)), true);
- $x = round($json['response']['count'] / 200) + 1;
- for($i = 1; $i <= $x; $i++) {
- $request_params = array(
- 'offset' => ($i * 200) - 200,
- 'count' => 200,
- 'access_token' => $token,
- 'v' => '5.101'
- ); $json = json_decode(file_get_contents('https://api.vk.com/method/messages.getConversations?'. http_build_query($request_params)), true);
- //print_r($json);
- $active_chats = array();
- $kicked_chats = array();
- $left_chats = array();
- for($s = 0; $s < 200; $s++) {
- $item = $json['response']['items'][$s];
- if($item['conversation']['peer']['type'] == "chat") {
- array_push($item['conversation']['chat_settings']['state'] == "kicked" ? $kicked_chats : ($item['conversation']['chat_settings']['state'] == "left" ? $left_chats : $active_chats), $item);
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement