E
E
EvgMul2016-08-15 17:02:47
PHP
EvgMul, 2016-08-15 17:02:47

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));

With print_r I see the following:
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
                        )

                )

        )

)

What is the problem, tell me please, I already broke my head.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vyacheslav, 2016-08-15
@EvgMul

What are $get_params?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question