Answer the question
In order to leave comments, you need to log in
How to upload photo vk api?
Hello masters.
Please tell me what kind of trouble is happening with api vk. The problem appears when trying to upload a photo to a user's or group's wall. Neither there nor there it is even possible to get the address for uploading an image (using the photos.getWallUploadServer method). I get error 15 (access error) all the time. Although it is strange that when I receive a token, I make a request for access to the wall, photos.
I get the token like this:
$url = 'https://oauth.vk.com/authorize';
$params = [
'client_id' => CLIENT_ID,
'redirect_uri' => 'https://oauth.vk.com/blank.html',
'response_type' => 'token',
'scope' => 'status,wall,groups,offline,friends'
];
$url = $url.'?'.http_build_query($params);
echo '<a href="'. $url .'">Получить токен</a>';
public function wallPhotosUpload() {
$url = 'https://api.vk.com/method/photos.getUploadServer?';
$params = [
'group_id' => $this->settings['group_id'],
'access_token' => $this->settings['token'],
'v' => '5.61',
];
$url .= http_build_query($params);
$result = file_get_contents($url);
self::print_arr($result);
}
Answer the question
In order to leave comments, you need to log in
The method is available only to standalone applications
Or check if there are permissions https://vk.com/dev/account.getAppPermissions
If not, then you need to get it in scope when creating a token
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question