Sends and sends the message, why is he not lagging?

I heard that after he received a request from Vkontakte, it is necessary to answer him the Ok to have it behind you. But, I not far behind. I do bot VC, and VC continuously sends the same request to my website....

/*

*/

class Group {
 public function __construct($params = [], $data = []) {
 $this->token = $params->token;
 $this->version = $params->version;
 $this->data = $data;
}

 public function reply($message = null) {
 return $this->sendMessage($this->data->object->message->peer_id, $message);
}
} 

/*

*/

$group = new Group($CONFIGURATION->GROUP, json_decode(file_get_contents("php://input")));

/*

*/

echo 'Ok';

/*

*/

switch($group->data->type) {
 case 'confirmation': {
 echo $CONFIGURATION->GROUP->CONFIRMATION;
break;
}
 case 'message_new': {
 echo 'Ok';

 $group->reply('Hello world!');

 echo 'Ok';

break;
}
}

/*

*/

echo 'Ok';
April 4th 20 at 12:55
3 answers
April 4th 20 at 12:57
Catch. This function sends the ok and closes the connection with the VC, that he thought that the script finished executing.
function sendOK() {
set_time_limit(0);
 ini_set('display_errors', 'Off');

 // for Nginx
 if (is_callable('fastcgi_finish_request')) {
 echo 'ok';
session_write_close();
fastcgi_finish_request();
 return True;
}
 // for Apache
ignore_user_abort(true);

ob_start();
 header('Content-Encoding: none');
 header('Content-Length: 2');
 header('Connection: close');
 echo 'ok';
ob_end_flush();
flush();
 return True;
 }

by https://github.com/digitalstars/simplevk
I have tried already. Does not help. How come on some message. So come... - Cory73 commented on April 4th 20 at 13:00
@Cory73Which server do you use? Apache, Nginx? - Judson_Streich71 commented on April 4th 20 at 13:03
April 4th 20 at 12:59
All right VC checks the answer, it should be OK, but in code it is clear that even if something will fail, he will receive the response "OK". Do we need to remove unnecessary displays the string "OK" should be displayed once. And there should be small letters
I understand. I, for example, showed, I tried to insert this ok. And in small letters wrote - Cory73 commented on April 4th 20 at 13:02
@Cory73, I Have the bot working now, and all is well. There should be a conclusion to do just "OK", well, what Latin is clear. May appear some warning. VC shows the response if it is not correct. To do this, go to the management community in the api tab, select the server tab, callback api, go to requests and find a button to display failed queries. Click on the query you can see that the server has sent the VC. - alexis_Bradt commented on April 4th 20 at 13:05
April 4th 20 at 13:01
In General, from the point of view of trudnosti architecturing your code should be ready for such challenges. Otherwise, why have such a code?
Why do you need one ? - Cory73 commented on April 4th 20 at 13:04
@Cory73, do not insult users. - abdullah.Kuvalis commented on April 4th 20 at 13:07

Find more questions by tags PHPAPIVKontakteBots