J
J
Jasur00902020-02-20 20:02:11
PHP
Jasur0090, 2020-02-20 20:02:11

Connecting Callback api VK The server returned an incorrect response: HTTP response code said error?

I'm making a simple bot to learn. You need to connect callback api. I downloaded a small bot here . I put my token and string, but the error is "The server returned the wrong response: HTTP response code said error". Referring to index.php

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Jasur0090, 2020-02-21
@Jasur0090

Solved a problem.
Paste this code.

<?php

if (!isset($_REQUEST)) {
return;
}

//Строка для подтверждения адреса сервера из настроек Callback API
$confirmation_token = 'хххххххх';

//Ключ доступа сообщества
$token = 'xxx';

//Получаем и декодируем уведомление
$data = json_decode(file_get_contents('php://input'));

//Проверяем, что находится в поле "type"
switch ($data->type) {
//Если это уведомление для подтверждения адреса...
case 'confirmation':
//...отправляем строку для подтверждения
echo $confirmation_token;
break;
}

The problem was in the host. Changed hosting.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question