Y
Y
yischyk2019-06-18 19:19:52
PHP
yischyk, 2019-06-18 19:19:52

How to do a search by VK groups?

<?php
              $search_get = file_get_contents('https://api.vk.com/method/groups.search?q=Music&offset=3&count=2&access_token='.$token.'&sort=0&fields=id,name,photo_200&v='.$v);
              $search = json_decode($search_get, true);
              $result = $search['response'][0];
              echo $result['id'];
            ?>

hello, I'm making a VK api request to unload groups, it gives an error
Notice: Undefined offset 0
when I make a vardump, then everything is fine

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2019-06-18
@yischyk

$result = $search['response']['items'][0];
echo $result['id']

here .
Another count comes in the response, you get it, and it contains one number and does not smell of any id.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question