Answer the question
In order to leave comments, you need to log in
Why is the document not loading through the VK API?
Hello. The problem is this, I'm trying to upload a document to a group via the VK API.
Images and videos are uploading fine.
The access token was obtained with the following line: oauth.vk.com/authorize?client_id=5587139&display=popup&scope=photos,video,docs,wall,groups,offline&response_type=token&v=5.53 scope contains the docs value, which means access to documents is also open.
Code to get the URL to download the document:
function myCurl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$request_params = [
'access_token' => TOKEN_VK,
'group_id' => ID_PUBLIC_VK,
'v' => '5.53'
];
$result = json_decode(myCurl('https://api.vk.com/method/docs.getWallUploadServer?'. $get_params));
stdClass Object
(
[error] => stdClass Object
(
[error_code] => 5
[error_msg] => User authorization failed: no access_token passed.
[request_params] => Array
(
[0] => stdClass Object
(
[key] => oauth
[value] => 1
)
[1] => stdClass Object
(
[key] => method
[value] => docs.getWallUploadServer
)
)
)
)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question