I'm migrating from Laravel 8 to Laravel 8 + Octane / Swoole. All works fine, but php://input
always are empty. Also, I check $_POST and $_SERVER values.
file_get_contents('php://input')
is used by AWS SNS Message Validator.
Any alterantive to read php://input
?
PHP code
echo "php://input: ".file_get_contents('php://input');
With PHP-FPM
$ curl -i -X POST --data "dataaaa" https://example.com/aws/sns/webhook
php://input: dataaaa
With Octane+Swoole
$ curl -i -X POST --data "dataaaa" https://example.com/aws/sns/webhook
php://input:
Problem
php://input
are not available on Swoole. Always are the same running process.Solution: PSR-7 Request
Of course, with octane,
symfony/psr-http-message-bridge
andnyholm/psr7
are required for Laravel PSR-7 requests.Also, if your problem is related with AWS SES, you need to change
Message::fromRawPostData()
toMessage::fromPsrRequest($request)
.