Не могу подтвердить сервер бота вк на heroku на php
Здравствуйте написал бота вк на php и выгружаю на heroku. Не могу подтвердить сервер в вк. Вот в логах:
2020-12-27T13:53:28.354654+00:00 app[web.1]: [2020-12-27 13:53:28] app.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "POST /bot" (uncaught exception) at /app/vendor/symfony/http-kernel/EventListener/RouterListener.php line 125 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"POST /bot\" at /app/vendor/symfony/http-kernel/EventListener/RouterListener.php:125, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): No routes found for \"/bot\". at /app/vendor/symfony/routing/Matcher/UrlMatcher.php:98)"} []
2020-12-27T13:53:28.354719+00:00 app[web.1]: [2020-12-27 13:53:28] app.DEBUG: < 404 [] []
Вк пишет Сервер вернул неправильный ответ: Invalid response code
Вот код бота: `
<?php
require('../vendor/autoload.php');
$app = new Silex\Application();
$app['debug'] = true;
// Register the monolog logging service
$app->register(new Silex\Provider\MonologServiceProvider(), array(
'monolog.logfile' => 'php://stderr',
));
// Register view rendering
$app->register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => __DIR__.'/views',
));
// Our web handlers
$app->post('/bot', function() use($app) {
$data = json_decode(file_get_contents('php://input'));
if (!$data)
return 'error';
if($data->secret !== getenv('VK_SECRET_TOKEN') && $data->type !== 'confirmation')
return 'error';
switch ($data->type)
{
case 'confirmation':
return getenv('VK_CONFIRMATION_CODE');
break;
}
return "error";
});
$app->run();
`