B
B
barder2020-09-01 19:20:22
PHP
barder, 2020-09-01 19:20:22

VK API attachments link how to specify link preview?

Hello everyone)
I am publishing a post to the group on Vkontakte:

$arPicture = CFile::GetPath($arFields["DETAIL_PICTURE"]);
$URLPicture = "https://". $_SERVER['SERVER_NAME'] . $arPicture);

$link         = $arFields['CANONICAL_PAGE_URL'];
 
// Отправляем сообщение.
$params = array(
  'v'            => '5.52',
  'access_token' => $access_token,
  'owner_id'     => '-' . $group_id, 
  'from_group'   => '1', 
  'message'      => $message,
  'attachments'  => $link
);
 
$result = file_get_contents('https://api.vk.com/method/wall.post?' . http_build_query($params));
$result = json_decode($result);
$VK_ID = $result->response->post_id;
print_r($VK_ID);

The post is published normally. Only the link preview shows the site logo.
how do i specify $URLPicture as the first view

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