You can tell me using the messages.getLongPollHistor 'y method, read the incoming message and give an answer to it, for example, if the incoming message was "Hello" , check "And hello to you" .. I could implement it without using LongPoll , just by message. get , but this is not exactly what I need to do it in the same way just under LongPoll does not work .. Here’s how I did:

<?php require_once "vk.api.php"; define('token', 'e495f5565966573062688ff988a83e5e39a45e3fb2a3ba7344cdb772545e7157a97259af8f1b3d386fb80'); $vk = new VK(token); $messages = $vk->request('messages.get', [ 'count' => '10', ]); file_get_contents($messages); echo "<pre>"; foreach ($messages['response'] as $message): if (!$message['read_state']) { if ($dialog['body'] == 'Привет') { // sleep(1); $reading = $vk->request('messages.markAsRead', [ 'peer_id' => $dialog['uid'], ]); $typing = $vk->request('messages.setActivity', [ 'user_id' => $dialog['uid'], 'type' => 'typing', ]); $send = $vk->request('messages.send', [ 'message' => "Дарова", 'attachment' => 'photo76386795_456239027', 'uid' => $dialog['uid'], ]); } endforeach; echo "</pre>"; 

    0