R
R
rusgayfer2017-07-28 07:06:14
In contact with
rusgayfer, 2017-07-28 07:06:14

How to output users.get users?

I make a request:

$user = json_decode(file_get_contents("https://api.vk.com/method/users.get?user_ids={$'users_id'}&name_case=acc&v=5.67"), true); 		

$users = '<a href="//vk.com/id'.$usersad['response'][0]['id'].'" target="_blank" >'.$usersad['response'][0]['first_name'].' '.$usersad['response'][0]['last_name'].'</a>';

But it displays only one user, all id are listed separated by commas. How to display all users?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iDrugov, 2017-07-28
@iDrugov

Well, what result did you expect without a cycle? ) It is necessary for each element in the response to go through and get ids, and then work with an array of ready-made code.
I'm new to php, but $users should be an array, i.e. not $users = code, but:

for(i = 0; i == что-то.length; i++){
$users[i] = '<a href="//vk.com/id'.$usersad['response'][i]['id'].'" target="_blank" >'.$usersad['response'][i]['first_name'].' '.$usersad['response'][i]['last_name'].'</a>';
i++;
}

More or less like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question