Answer the question
In order to leave comments, you need to log in
How to accept data using POST method in Yii2?
You need to get data from another site using the POST method.
Immediately after redirecting to my site from an external site, I get a Bad Request error (# 400).
If you call the controller directly, then there are no errors.
Disabling CSRF didn't help either.
Tell me, please, what could be the problem.
Answer the question
In order to leave comments, you need to log in
That's more correct
you can pass in the header with the name X-CSRF-Token if AJAX
or disable the check in the controller (not recommended)
public function beforeAction($action)
{
if ($action->id == 'no-csrf') {
Yii::$app->controller->enableCsrfValidation = false;
}
return parent::beforeAction($action);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question