A little stupid question ... but how to accept a request from vk in json format of the following type

{"type":"confirmation","group_id":000000000} 

How does php catch this POST request in JSON format?

  • and what in the $ _POST variable comes in? - Bookin
  • Literally: "To receive notifications, you need to confirm the server address. A POST request will be sent to it containing JSON:" that's all. and the line below is in question. I therefore cannot understand how to accept that ... - Vladimir Alexandrov
  • @Bookin, how to see what comes to POST without a name? I am not familiar with php unfortunately ( - Vladimir Alexandrov

1 answer 1

As I understand you are trying to work with Callback Api , in the same place, on the page below, there is an example in php

 ... //Получаем и декодируем уведомление $data = json_decode(file_get_contents('php://input')); //Проверяем, что находится в поле "type" switch ($data->type) { //Если это уведомление для подтверждения адреса сервера... case 'confirmation': //...отправляем строку для подтверждения адреса echo $confirmation_token; break; ... 
  • Thank you, I just did not understand how to accept the request without a name) - Vladimir Alexandrov