Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1. <?php
  2.  
  3. $token = "Тут токен";
  4. $request_params = array(
  5. 'offset' => 0,
  6. 'count' => 1,
  7. 'access_token' => $token,
  8. 'v' => '5.101'
  9. ); $json = json_decode(file_get_contents('https://api.vk.com/method/messages.getConversations?'. http_build_query($request_params)), true);
  10. $x = round($json['response']['count'] / 200) + 1;
  11.  
  12. for($i = 1; $i <= $x; $i++) {
  13. $request_params = array(
  14. 'offset' => ($i * 200) - 200,
  15. 'count' => 200,
  16. 'access_token' => $token,
  17. 'v' => '5.101'
  18. ); $json = json_decode(file_get_contents('https://api.vk.com/method/messages.getConversations?'. http_build_query($request_params)), true);
  19. //print_r($json);
  20. $active_chats = array();
  21. $kicked_chats = array();
  22. $left_chats = array();
  23. for($s = 0; $s < 200; $s++) {
  24. $item = $json['response']['items'][$s];
  25. if($item['conversation']['peer']['type'] == "chat") {
  26. array_push($item['conversation']['chat_settings']['state'] == "kicked" ? $kicked_chats : ($item['conversation']['chat_settings']['state'] == "left" ? $left_chats : $active_chats), $item);
  27. }
  28. }
  29. }
  30.  
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement