$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']."')";
$query = "INSERT INTO `user`(`user_id`,`sex`) VALUES ($user_id,'".$result['fields']."')";
$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 = "SELECT `user_id` FROM `user` WHERE user_id = $user_id";
$sql = mysqli_query ($link,$query);
if (mysqli_num_rows($sql) > 0){
$user = mysqli_fetch_assoc(mysqli_query($link,"SELECT * FROM `user` WHERE user_id = $user_id"));
}
else{
$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,'".$result['sex']."')";
$result = mysqli_query ($link,$query);
$user = mysqli_fetch_assoc(mysqli_query($link,"SELECT * FROM `user` WHERE user_id = $user_id"));
$kbd = [
'one_time' => false,
'buttons' => [
[getBtn("Парень", 'secondary', 'Парень'),getBtn("Девушка", 'positive', 'Девушка')],
]
];
message($user_id,'Выбери пол собеседника',$kbd);
}
$result = curl_exec($ch);
$result = json_decode($result, 1);
$result = curl_exec($ch);
return json_decode($result, 1);
$result = curl_exec($ch);
$result = json_decode($result, 1);
$result = json_decode($result, 1);
print_r($result);