R
R
rusgayfer2017-07-20 08:09:33
PHP
rusgayfer, 2017-07-20 08:09:33

How to get group admin id using groups.getMembers method?

I make a request:

$membersadmin = json_decode(file_get_contents("https://api.vk.com/method/groups.getMembers?group_id={$groupId}&count=100&filter=managers&access_token={$tokenadmin}"),true);

I output:
htmlspecialchars($membersadmin['response']['users'][0]['id'])

The problem is that it displays only the id of one first admin, but I need all of them at once. How to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Kozhin, 2017-07-20
@rusgayfer

$membersadmin['response']['users'] [0] ['id']
Loop through

foreach($membersadmin['response']['users'] as $user) {
  $adminIds[] = $user['id'];
}
# $adminIds - нумерованный массив айдишников

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question