Answer the question
In order to leave comments, you need to log in
Wall.get php VK API, how to get username and photo?
There is a code that displays photos that users have attached to posts:
<?php
$wall = file_get_contents("http://api.vk.com/method/wall.get?extended=1&owner_id=-21894049&v=5.21&filter=all&count=30"); // Отправляем запрос
$wall = json_decode($wall); // Преобразуем JSON-строку в массив
$wall = $wall->response->items; // Получаем массив
for ($i = 0; $i < count($wall); $i++) {
$x = $wall[$i]->text;
if($x !== ''){ // Не выводим пустые посты.
echo "".$wall[$i]->text."</br>"; // Выводим текст поста
$a = $wall[$i]->attachments[0]->photo->photo_604;
echo "<img src= '$a'>";
}}
?>
$a = $wall[$i]->profiles[0]->id->photo_50;
echo "<img src= '$a'>";
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question