What is the error code
Messages are simply not sent

<?php if (!isset($_REQUEST)) { return; } $confirmationToken = '36c3fc12'; $token = 'XXX'; $secretKey = 'testifvk'; $data = json_decode(file_get_contents('php://input')); if(strcmp($data->secret, $secretKey) !== 0 && strcmp($data->type, 'confirmation') !== 0) return; switch ($data->type) { case 'confirmation': echo $confirmationToken; break; case 'group_join': $userId = $data->object->user_id; $userInfo = json_decode(file_get_contents("https://api.vk.com/method/users.get?user_ids={$userId}&v=5.0")); $user_name = $userInfo->response[0]->first_name; $request_params = array( 'message' => "Привет {$user_name}, спасибо за подписочку", 'user_id' => $userId, 'access_token' => $token, 'v' => '5.0' ); $get_params = http_build_query($request_params); file_get_contents('https://api.vk.com/method/messages.send?' . $get_params); echo('ok'); break; case 'group_leave': $userId = $data->object->user_id; $userInfo = json_decode(file_get_contents("https://api.vk.com/method/users.get?user_ids={$userId}&v=5.0")); $user_name = $userInfo->response[0]->first_name; $request_params = array( 'message' => "{$user_name}, еххх наш сервер будет скучать", 'user_id' => $userId, 'access_token' => $token, 'v' => '5.0' ); $get_params = http_build_query($request_params); file_get_contents('https://api.vk.com/method/messages.send?' . $get_params); echo('ok'); break; } ?> 
  • What is your mistake? - Ruslan Melnichenko
  • I don’t know the essence of that, but how to look - Sasha Adamov
  • Run the script and see if it gives errors, or gives the desired results. You can either upload to your host with Apache support or download a server to a computer, for example XAMP - Ruslan Melnichenko
  • @RuslanMelnichenko will not launch it yourself there, you need to set all the parameters as it is to pass - Sasha Adamov
  • Create a group of VC and go there to Callback and everything is there - Ruslan Melnichenko

0