V
V
Vitaly2017-05-05 21:16:39
PHP
Vitaly, 2017-05-05 21:16:39

How to get gid parameters?

How can I get the gid parameters for each community from this JSON?

{
  "response": [4,
  {
    "gid": 142342685,
    "name": "Foxy Bot | Создай своего бота (Beta)",
    "screen_name": "foxybotgroup",
    "is_closed": 0,
    "type": "group",
    "photo": "https:\/\/pp.userapi.com\/c837226\/v837226447\/37d83\/0HoKk2bVjqg.jpg",
    "photo_medium": "https:\/\/pp.userapi.com\/c837226\/v837226447\/37d82\/wesQ6khbojQ.jpg",
    "photo_big": "https:\/\/pp.userapi.com\/c837226\/v837226447\/37d81\/8CyKKaZy0QI.jpg"
  },
  {
    "gid": 145826725,
    "name": "FoxyWeb - 145826725",
    "screen_name": "club145826725",
    "is_closed": 0,
    "type": "group",
    "photo": "https:\/\/vk.com\/images\/community_50.png",
    "photo_medium": "https:\/\/vk.com\/images\/community_100.png",
    "photo_big": "https:\/\/vk.com\/images\/community_200.png"
  },
  {
    "gid": 146389115,
    "name": "Fleo Web - 146389115",
    "screen_name": "club146389115",
    "is_closed": 0,
    "type": "group",
    "photo": "https:\/\/vk.com\/images\/community_50.png",
    "photo_medium": "https:\/\/vk.com\/images\/community_100.png",
    "photo_big": "https:\/\/vk.com\/images\/community_200.png"
  },
  {
    "gid": 145511947,
    "name": "BetaEasyBot",
    "screen_name": "club145511947",
    "is_closed": 0,
    "type": "group",
    "photo": "https:\/\/vk.com\/images\/community_50.png",
    "photo_medium": "https:\/\/vk.com\/images\/community_100.png",
    "photo_big": "https:\/\/vk.com\/images\/community_200.png"
  }]
}
Help plz)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
Tom Nolane, 2017-05-05
@vitcorp

$res = json_decode($json); 
foreach ($res->response as $array) 
{ 
    echo $array->gid. '<br />'; 
}

E
entermix, 2017-05-05
@entermix

Use json_decode

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question