C
C
crack_user2021-07-30 17:52:10
PHP
crack_user, 2021-07-30 17:52:10

How to get response from VK API methods?

I don't know how to get an answer from VK. It is necessary to write the gender "sex" of the user - in the database.
And in general, is the query built correctly?

$request_params = array( 
      'user_ids' => $user_id, 
      'fields' => 'sex', 
      'access_token' => $token, 
      'v' => '5.80'
    ); 
    $date = http_build_query($request_params); 
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $date);
    curl_setopt($ch, CURLOPT_URL,"https://api.vk.com/method/users.get?");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch);
    return json_decode($result, 1);
    $query = "INSERT INTO `user`(`user_id`,`sex`) VALUES ($user_id,'".$request_params['fields']."')";

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