V
V
Viplayer2019-06-24 03:31:06
PHP
Viplayer, 2019-06-24 03:31:06

Why can't I retrieve the data?

I'm trying to get an admin in VK api, the code dies before / after foreach

$arr_users = $vk->request('messages.getConversationMembers', ['chat_id' => $peer_id]);
if ($message == "Чек" or $message == "чек") {
    $vk->sendMessage($peer_id, "Понял, что есть смс");
    foreach($arr_users['items'] as $item) {
        $vk->sendMessage($peer_id, "как");
        if ($item['member_id'] == $id) {
            $vk->sendMessage($peer_id, "Нашел в списке конфы");
            if (!empty($item['is_admin'])) {
                $vk->sendMessage($peer_id, "Админ");
            } else {
                $vk->sendMessage($peer_id, "Не админ");
            }
        }
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lightmanLP, 2019-06-27
@lightmanLP

The bot needs an admin to use the messages.getConversationMembers method. Perhaps the method returns an error and therefore nothing comes out.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question