D
D
Diversia2022-02-10 17:02:58
PHP
Diversia, 2022-02-10 17:02:58

Why is the photo not published on the wall of the VKontakte group?

Please tell me why when posting to VKontakte an error is displayed:

{"error":{"error_code":15,"error_msg":"Access denied: no access to call this method","request_params":[{"key":"group_id","value":"147692606"},{"key":"v","value":"5.81"},{"key":"method","value":"photos.getWallUploadServer"},{"key":"oauth","value":"1"}]}}

The following rights have been obtained:
https://oauth.vk.com/authorize?client_id=ID_ПРИЛОЖЕНИЯ&display=page
&redirect_uri=https://api.vk.com/blank.html&scope=offline,wall,photos
&response_type=code

Further:
https://oauth.vk.com/access_token?client_id=ID_ПРИЛОЖЕНИЯ
&client_secret=ЗАЩИЩЕННЫЙ_КЛЮЧ&redirect_uri=https://api.vk.com/blank.html
&code=СЕКРЕТНЫЙ_КОД

PHP:
$group_id     = 123456;
$access_token = '***';
$message      = 'Hello, world!';
$image        = __DIR__ . '/upload/test.jpg';
$server = file_get_contents('https://api.vk.com/method/photos.getWallUploadServer?group_id=' . $group_id . '&access_token=' . $access_token . '&v=5.81');

At the same time, the wall.post method works if the photo is not uploaded.

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