Answer the question
In order to leave comments, you need to log in
Is it possible to somehow send messages to the wall in the VK group through cron?
Hello. Something I can’t figure out how to post messages on VKontakte from the server side.
Tools:
"atehnix/laravel-vk-requester": "^0.7.0",
'scope' => [
'offline,wall,groups',
],
$api = new \ATehnix\VkClient\Client;
$api->setDefaultToken("adb1eb859de7d1aa79ca1611b5876643798a4bf4c4956c8899d37572c9c9e2061bcb0852c50731262d48b");
$response = $api->request('groups.get', ['user_id' => 285585401, 'extended'=>true, 'filter'=>'admin,editor,moder']);
$groupId = $response['response']['items'][0]['id'];
$response = $api->request('wall.post', ['owner_id' => 285585401, 'message'=> 'its work!']); // в данном случае пытаюсь разместить у себя на странице
Answer the question
In order to leave comments, you need to log in
It is certainly possible to do this.
In your code, you mixed up two concepts from the VK API a little. User access key and service access key.
Your application receives a service access key when registering with vk developers. But the user's access key can be obtained by passing Oauth authorization. In the wall.post method, it is necessary to use the user's access key. Those. the algorithm is something like this: a user (or you yourself) clicks on your site on the link "Login via Vkontakte", in response he receives a key that you then use to make requests to vk.api
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question