Q
Q
querkin2018-02-18 12:35:19
PHP
querkin, 2018-02-18 12:35:19

How to get attachment from vk callback api?

I am writing a script that receives the 'wall_post_new' event from the callback api vk, and then publishes the text and photos from the post to the site. It is not possible to implement getting links to images from a VK post. It is necessary to process the array and display links from there, which is still difficult for me.
How to get the url correctly?

//Подтверждаем адрес сервевера, обработка запроса от вк - сделано
//Получаем уведомление о новом посте
    case 'wall_post_new':
    
        $attachments = $data->object->attachments; //Приняли массив с прикрепленными к посту данными 
//Проходимся по массиву и получаем ссылки - как это реализовать?
foreach ($attachments as $k => $attachment) { 
            switch ($attachment->type) {
                    
                    case 'photo':
//получаем ссылки                      
break;
}
        }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question