E
E
eimagsumov2015-12-14 23:23:48
PHP
eimagsumov, 2015-12-14 23:23:48

What is the error when receiving a response from VK?

I set up authorization through VK. API request. The users.get method Nothing comes up
in response. Tell me, where did you go wrong?
Those. var_dump will show bool(false)

public function get_user(){
        if(!$this->token){
            exit("wrong code!");
        }
        if(!$this->uid){
            exit("wrong code!");
        }
        $query2 = "?user_id=".$this->uid."&access_token=".$this->token;

        $kur = curl_init();

        curl_setopt($kur, CURLOPT_URL, URL_GET_USER.$query2);
        curl_setopt($kur, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($kur, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($kur, CURLOPT_RETURNTRANSFER, TRUE);

        $result2 = curl_exec($kur);
        curl_close($kur);
        var_dump($result2);

        $_SESSION['vk_user'] = json_decode($result2);
        
        //$this->redirect(PRIVATE_URL);
    }

define("URL_GET_USER",'https://api.vk.com/method/users.get');

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2015-12-14
@Rsa97

users.get
user_id s and not user_id, no access_token needed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question