Answer the question
In order to leave comments, you need to log in
VK API how to make a post in a group?
Application type site, getting a token:
https://oauth.vk.com/authorize?client_id=<app_id>&scope=photos,wall,offline&redirect_uri=https://oauth.vk.com/blank.html&response_type=token
https://api.vk.com/method/wall.post?owner_id=<id группы>&message=<текст сообщения>&access_token=<ранее полученный токен>
Answer the question
In order to leave comments, you need to log in
From the VKontakte documentation:
This method is available only to Standalone applications and web applications that use the confirmation window.
Of course, off topic, but can anyone share an example for php posting to a VK group?
I wrote a banal function. So far without attachment files. Just send text.
function VK_POST($text) {
define('TOKEN','<токен приложения>');
define('GROUP_ID','<ID группы>');
define('API_VERSION','5.62');
$url = sprintf('https://api.vk.com/method/wall.post?');
$ch = curl_init();
curl_setopt_array( $ch, array(
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_SSL_VERIFYHOST => FALSE,
CURLOPT_POSTFIELDS => array(
'owner_id' => GROUP_ID,
'from_group' => 1,
'message' => $text,
'access_token' => TOKEN,
'v' => API_VERSION
),
CURLOPT_URL => $url,
));
$query = curl_exec($ch);
curl_close($ch);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question