M
M
mrjurko2016-10-09 22:30:06
In contact with
mrjurko, 2016-10-09 22:30:06

PHP and json how to process the response from vkontakte?

Tell me what's the problem. There is the following code for working with the vk API:
$td_data = get_json(" https://api.vk.com/method/groups.getMembers?group_... ");
$r = json_decode($td_data);
$buffy_array = $r->response[0]->count;
The VK server response is:
{"response":{"count":3636,"items":[]}}
We need to get the value of the count object, but nothing happens.
Where is the mistake?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rou1997, 2016-10-10
@Rou1997

response is an object, not an array, so treat it like an object, $r->response->count;by the way, count is not a buffy_ array either .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question