We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

addPost Error

Hey,

Just starting out with Phalcon and I'm trying to get a REST api working to manage my apps i/o of data but I'm having a major issue trying to add a route via addPost.

The routes.php file has this code:

$router = new Phalcon\Mvc\Router(false);

$router->addGet("/", array(
    'controller' => 'index',
    'action' => 'index',
));

$router->addGet("/register", array(
    'controller' => 'register',
    'action' => 'index',
));

$router->addPost("/api/1.0/company/create", array(
    'controller' => 'ApiController',
    'action' => 'postEndpoint',
));

bootstrap:

    ....

    $application = new Application($di);

    require APP_PATH . 'app/config/routes.php';

    echo $application->handle()->getContent();

addGet() works fine, but with addPost, when I submitted the data via a form to the post url, I just get a blank screen. I've got the debug options turned on so I think I have an issue outside of PHP. Can anyone give me some insight as to what i am doing wrong here?



3.9k
Accepted
answer

Please can this discussion be closed. the Issue was with a security plugin ported over from the INVO tutorial.